@Test public void selectable() throws Exception { Transaction t; t = new Transaction(UNITTEST); t.getConfidence().setConfidenceType(TransactionConfidence.ConfidenceType.PENDING); assertFalse(DefaultCoinSelector.isSelectable(t)); t.getConfidence().setSource(TransactionConfidence.Source.SELF); assertFalse(DefaultCoinSelector.isSelectable(t)); t.getConfidence().markBroadcastBy(new PeerAddress(UNITTEST, InetAddress.getByName("1.2.3.4"))); assertTrue(DefaultCoinSelector.isSelectable(t)); t.getConfidence().markBroadcastBy(new PeerAddress(UNITTEST, InetAddress.getByName("5.6.7.8"))); assertTrue(DefaultCoinSelector.isSelectable(t)); t = new Transaction(UNITTEST); t.getConfidence().setConfidenceType(TransactionConfidence.ConfidenceType.BUILDING); assertTrue(DefaultCoinSelector.isSelectable(t)); t = new Transaction(REGTEST); t.getConfidence().setConfidenceType(TransactionConfidence.ConfidenceType.PENDING); t.getConfidence().setSource(TransactionConfidence.Source.SELF); assertTrue(DefaultCoinSelector.isSelectable(t)); }
public static boolean isSelectable(Transaction tx) { TransactionConfidence confidence = tx.getConfidence(); TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); return type.equals(TransactionConfidence.ConfidenceType.BUILDING) || type.equals(TransactionConfidence.ConfidenceType.PENDING) && confidence.getSource().equals(TransactionConfidence.Source.SELF) && (confidence.numBroadcastPeers() > 0 || tx.getParams().getId().equals(NetworkParameters.ID_REGTEST)); }
DefaultCoinSelector implements CoinSelector { public static boolean isSelectable(Transaction tx) { TransactionConfidence confidence = tx.getConfidence(); TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); return type.equals(TransactionConfidence.ConfidenceType.BUILDING) || type.equals(TransactionConfidence.ConfidenceType.PENDING) && confidence.getSource().equals(TransactionConfidence.Source.SELF) && (confidence.numBroadcastPeers() > 0 || tx.getParams().getId().equals(NetworkParameters.ID_REGTEST)); } }
DefaultCoinSelector implements CoinSelector { public static boolean isSelectable(Transaction tx) { TransactionConfidence confidence = tx.getConfidence(); TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); return type.equals(TransactionConfidence.ConfidenceType.BUILDING) || type.equals(TransactionConfidence.ConfidenceType.PENDING) && confidence.getSource().equals(TransactionConfidence.Source.SELF) && (confidence.numBroadcastPeers() > 0 || tx.getParams().getId().equals(NetworkParameters.ID_REGTEST)); } protected  DefaultCoinSelector(); }
DefaultCoinSelector implements CoinSelector { public static boolean isSelectable(Transaction tx) { TransactionConfidence confidence = tx.getConfidence(); TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); return type.equals(TransactionConfidence.ConfidenceType.BUILDING) || type.equals(TransactionConfidence.ConfidenceType.PENDING) && confidence.getSource().equals(TransactionConfidence.Source.SELF) && (confidence.numBroadcastPeers() > 0 || tx.getParams().getId().equals(NetworkParameters.ID_REGTEST)); } protected  DefaultCoinSelector(); @Override CoinSelection select(Coin target, List<TransactionOutput> candidates); static boolean isSelectable(Transaction tx); static DefaultCoinSelector get(); }
DefaultCoinSelector implements CoinSelector { public static boolean isSelectable(Transaction tx) { TransactionConfidence confidence = tx.getConfidence(); TransactionConfidence.ConfidenceType type = confidence.getConfidenceType(); return type.equals(TransactionConfidence.ConfidenceType.BUILDING) || type.equals(TransactionConfidence.ConfidenceType.PENDING) && confidence.getSource().equals(TransactionConfidence.Source.SELF) && (confidence.numBroadcastPeers() > 0 || tx.getParams().getId().equals(NetworkParameters.ID_REGTEST)); } protected  DefaultCoinSelector(); @Override CoinSelection select(Coin target, List<TransactionOutput> candidates); static boolean isSelectable(Transaction tx); static DefaultCoinSelector get();  }