mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 11:15:51 +00:00
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).
This commit is contained in:
parent
387717c6c5
commit
9d96f77f19
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user