From 9d96f77f19d6f7967dff4602f5c263d58657f954 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Sun, 27 Oct 2013 15:37:06 +0100 Subject: [PATCH] PeerGroup: add logging of the change reason to the broadcast confidence listener. Also attach the listener to the pinned TX (it shouldn't make any difference normally, but when mixed with bluetooth stuff it might possibly change things). --- core/src/main/java/com/google/bitcoin/core/PeerGroup.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/google/bitcoin/core/PeerGroup.java b/core/src/main/java/com/google/bitcoin/core/PeerGroup.java index 86c4741f..5533bc46 100644 --- a/core/src/main/java/com/google/bitcoin/core/PeerGroup.java +++ b/core/src/main/java/com/google/bitcoin/core/PeerGroup.java @@ -1197,14 +1197,14 @@ public class PeerGroup extends AbstractIdleService implements TransactionBroadca final Transaction pinnedTx = memoryPool.seen(tx, somePeer.getAddress()); // Prepare to send the transaction by adding a listener that'll be called when confidence changes. // Only bother with this if we might actually hear back: - if (minConnections > 1) tx.getConfidence().addEventListener(new TransactionConfidence.Listener() { + if (minConnections > 1) pinnedTx.getConfidence().addEventListener(new TransactionConfidence.Listener() { public void onConfidenceChanged(Transaction tx, TransactionConfidence.Listener.ChangeReason reason) { // The number of peers that announced this tx has gone up. final TransactionConfidence conf = tx.getConfidence(); int numSeenPeers = conf.numBroadcastPeers(); boolean mined = tx.getAppearsInHashes() != null; - log.info("broadcastTransaction: TX {} seen by {} peers{}", - new Object[]{pinnedTx.getHashAsString(), numSeenPeers, mined ? " and mined" : ""}); + log.info("broadcastTransaction: {}: TX {} seen by {} peers{}", reason, pinnedTx.getHashAsString(), + numSeenPeers, mined ? " and mined" : ""); if (!(numSeenPeers >= minConnections || mined)) return; // We've seen the min required number of peers announce the transaction, or it was included