Ignore chain sync verification and relaying when -testnode=1

This commit is contained in:
Duke Leto
2022-07-01 21:40:39 -04:00
parent 71a72c9c60
commit 15d254af10
2 changed files with 8 additions and 2 deletions

View File

@@ -43,6 +43,7 @@
#include <wolfssl/ssl.h>
#include <hush/tlsmanager.cpp>
using namespace hush;
extern int32_t HUSH_TESTNODE;
// Dump addresses to peers.dat every 5 minutes (300s)
// Satoshi originally used 10 seconds(!), did they know something Peter Wuille didn't?
@@ -2120,7 +2121,12 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
random_shuffle( vRelayNodes.begin(), vRelayNodes.end(), GetRandInt );
vRelayNodes.resize(newSize);
fprintf(stderr, "%s: Relaying to %lu of %lu peers\n", __func__, newSize, vNodes.size() );
if (HUSH_TESTNODE==1 && vNodes.size() == 0) {
fprintf(stderr, "%s: -testnode=1, no peers, not relaying\n", __func__ );
return;
} else {
fprintf(stderr, "%s: Relaying to %lu of %lu peers\n", __func__, newSize, vNodes.size() );
}
// Only relay to randomly chosen 50% of peers
BOOST_FOREACH(CNode* pnode, vRelayNodes)