Wallet.setTransactionBroadcaster(): Error message for precondition.

This commit is contained in:
Andreas Schildbach
2016-06-04 11:42:46 +02:00
parent 483eda4c65
commit c01cb2c42f

View File

@@ -5068,7 +5068,8 @@ public class Wallet extends BaseTaggableObject
// Don't hold the wallet lock whilst doing this, so if the broadcaster accesses the wallet at some point there
// is no inversion.
for (Transaction tx : toBroadcast) {
checkState(tx.getConfidence().getConfidenceType() == ConfidenceType.PENDING);
ConfidenceType confidenceType = tx.getConfidence().getConfidenceType();
checkState(confidenceType == ConfidenceType.PENDING, "Expected PENDING, was %s.", confidenceType);
// Re-broadcast even if it's marked as already seen for two reasons
// 1) Old wallets may have transactions marked as broadcast by 1 peer when in reality the network
// never saw it, due to bugs.