3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 14:54:15 +00:00

PeerGroup: configure peer as download peer even when there is no chain, but don't configure download params as that would trigger block fetch.

This commit is contained in:
Mike Hearn 2014-12-21 14:03:13 +01:00
parent 8f219ff458
commit f82f160c2c
2 changed files with 4 additions and 10 deletions

View File

@ -1251,7 +1251,6 @@ public class PeerGroup implements TransactionBroadcaster {
// aren't relevant to our wallet. We may still receive some false positives, which is
// OK because it helps improve wallet privacy. Old nodes will just ignore the message.
if (bloomFilterMerger.getLastFilter() != null) peer.setBloomFilter(bloomFilterMerger.getLastFilter());
// Link the peer to the memory pool so broadcast transactions have their confidence levels updated.
peer.setDownloadData(false);
// TODO: The peer should calculate the fast catchup time from the added wallets here.
for (Wallet wallet : wallets)
@ -1320,15 +1319,8 @@ public class PeerGroup implements TransactionBroadcaster {
private void setDownloadPeer(@Nullable Peer peer) {
lock.lock();
try {
if (downloadPeer == peer) {
if (downloadPeer == peer)
return;
}
if (chain == null) {
// PeerGroup creator did not want us to download any data. We still track the download peer for
// informational purposes.
downloadPeer = peer;
return;
}
if (downloadPeer != null) {
log.info("Unsetting download peer: {}", downloadPeer);
if (downloadListener != null)
@ -1341,7 +1333,8 @@ public class PeerGroup implements TransactionBroadcaster {
if (downloadListener != null)
peer.addEventListener(downloadListener, Threading.SAME_THREAD);
downloadPeer.setDownloadData(true);
downloadPeer.setDownloadParameters(fastCatchupTimeSecs, bloomFilterMerger.getLastFilter() != null);
if (chain != null)
downloadPeer.setDownloadParameters(fastCatchupTimeSecs, bloomFilterMerger.getLastFilter() != null);
}
} finally {
lock.unlock();

View File

@ -36,6 +36,7 @@ public class WatchMempool {
@Override
public void onTransaction(Peer peer, Transaction tx) {
try {
log.info("tx {}", tx.getHash());
if (tx.getOutputs().size() != 1) return;
if (!tx.getOutput(0).getScriptPubKey().isSentToRawPubKey()) return;
log.info("Saw raw pay to pubkey {}", tx);