diff --git a/doc/bips.md b/doc/bips.md index 41ffdbd75e..9eb30823b5 100644 --- a/doc/bips.md +++ b/doc/bips.md @@ -15,7 +15,7 @@ BIPs that are implemented by Bitcoin Core (up-to-date up to **v0.13.0**): * [`BIP 35`](https://github.com/bitcoin/bips/blob/master/bip-0035.mediawiki): The 'mempool' protocol message (and the protocol version bump to 60002) has been implemented since **v0.7.0** ([PR #1641](https://github.com/bitcoin/bitcoin/pull/1641)). * [`BIP 37`](https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki): The bloom filtering for transaction relaying, partial merkle trees for blocks, and the protocol version bump to 70001 (enabling low-bandwidth SPV clients) has been implemented since **v0.8.0** ([PR #1795](https://github.com/bitcoin/bitcoin/pull/1795)). * [`BIP 42`](https://github.com/bitcoin/bips/blob/master/bip-0042.mediawiki): The bug that would have caused the subsidy schedule to resume after block 13440000 was fixed in **v0.9.2** ([PR #3842](https://github.com/bitcoin/bitcoin/pull/3842)). -* [`BIP 61`](https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki): The 'reject' protocol message (and the protocol version bump to 70002) was added in **v0.9.0** ([PR #3185](https://github.com/bitcoin/bitcoin/pull/3185)). +* [`BIP 61`](https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki): The 'reject' protocol message (and the protocol version bump to 70002) was added in **v0.9.0** ([PR #3185](https://github.com/bitcoin/bitcoin/pull/3185)). Starting *v0.16.0*, whether to send reject messages can be configured with the `-enablebip61` option. * [`BIP 65`](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki): The CHECKLOCKTIMEVERIFY softfork was merged in **v0.12.0** ([PR #6351](https://github.com/bitcoin/bitcoin/pull/6351)), and backported to **v0.11.2** and **v0.10.4**. Mempool-only CLTV was added in [PR #6124](https://github.com/bitcoin/bitcoin/pull/6124). * [`BIP 66`](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki): The strict DER rules and associated version 3 blocks have been implemented since **v0.10.0** ([PR #5713](https://github.com/bitcoin/bitcoin/pull/5713)). * [`BIP 68`](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki): Sequence locks have been implemented as of **v0.12.1** ([PR #7184](https://github.com/bitcoin/bitcoin/pull/7184)), and have been activated since *block 419328*. diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index 53675979cc..6e3937b6c9 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -95,7 +95,11 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm if (strCommand == NetMsgType::MNGOVERNANCESYNC) { if (pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) { LogPrint(BCLog::GOBJECT, "MNGOVERNANCESYNC -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION))); + } return; } @@ -140,7 +144,11 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm if (pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) { LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECT -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION))); + } return; } @@ -215,7 +223,11 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm if (pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) { LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION))); + } } // Ignore such messages until masternode list is synced diff --git a/src/init.cpp b/src/init.cpp index c01efa57bf..4ad901da4f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -488,6 +488,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-discover", _("Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)")); strUsage += HelpMessageOpt("-dns", _("Allow DNS lookups for -addnode, -seednode and -connect") + " " + strprintf(_("(default: %u)"), DEFAULT_NAME_LOOKUP)); strUsage += HelpMessageOpt("-dnsseed", _("Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect used)")); + strUsage += HelpMessageOpt("-enablebip61", strprintf(_("Send reject messages per BIP61 (default: %u)"), DEFAULT_ENABLE_BIP61)); strUsage += HelpMessageOpt("-externalip=", _("Specify your own public address")); strUsage += HelpMessageOpt("-forcednsseed", strprintf(_("Always query for peer addresses via DNS lookup (default: %u)"), DEFAULT_FORCEDNSSEED)); strUsage += HelpMessageOpt("-listen", _("Accept connections from outside (default: 1 if no -proxy or -connect)")); @@ -1285,6 +1286,8 @@ bool AppInitParameterInteraction() if (gArgs.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS)) nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM); + g_enable_bip61 = gArgs.GetBoolArg("-enablebip61", DEFAULT_ENABLE_BIP61); + nMaxTipAge = gArgs.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE); if (gArgs.IsArgSet("-vbparams")) { diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 4448e21ec6..c0b372f8ea 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -77,6 +77,7 @@ static_assert(INBOUND_PEER_TX_DELAY >= MAX_GETDATA_RANDOM_DELAY, static const unsigned int MAX_GETDATA_SZ = 1000; std::atomic nTimeBestReceived(0); // Used only to inform the wallet of when we last received a block +bool g_enable_bip61 = DEFAULT_ENABLE_BIP61; struct IteratorComparator { @@ -2061,7 +2062,9 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr // Each connection can only send one version message if (pfrom->nVersion != 0) { - connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_DUPLICATE, std::string("Duplicate version message"))); + if (g_enable_bip61) { + connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_DUPLICATE, std::string("Duplicate version message"))); + } LOCK(cs_main); Misbehaving(pfrom->GetId(), 1); return false; @@ -2090,8 +2093,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr if (!pfrom->fInbound && !pfrom->fFeeler && !pfrom->m_manual_connection && !HasAllDesirableServiceFlags(nServices)) { LogPrint(BCLog::NET, "peer=%d does not offer the expected services (%08x offered, %08x expected); disconnecting\n", pfrom->GetId(), nServices, GetDesirableServiceFlags(nServices)); - connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_NONSTANDARD, - strprintf("Expected to offer services %08x", GetDesirableServiceFlags(nServices)))); + if (g_enable_bip61) { + connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_NONSTANDARD, + strprintf("Expected to offer services %08x", GetDesirableServiceFlags(nServices)))); + } pfrom->fDisconnect = true; return false; } @@ -2100,8 +2105,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr { // disconnect from peers older than this proto version LogPrint(BCLog::NET, "peer=%d using obsolete version %i; disconnecting\n", pfrom->GetId(), nVersion); - connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, + strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION))); + } pfrom->fDisconnect = true; return false; } @@ -2880,9 +2887,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr LogPrint(BCLog::MEMPOOLREJ, "%s from peer=%d was not accepted: %s\n", tx.GetHash().ToString(), pfrom->GetId(), FormatStateMessage(state)); - if (state.GetRejectCode() > 0 && state.GetRejectCode() < REJECT_INTERNAL) // Never send AcceptToMemoryPool's internal codes over P2P + if (g_enable_bip61 && state.GetRejectCode() > 0 && state.GetRejectCode() < REJECT_INTERNAL) { // Never send AcceptToMemoryPool's internal codes over P2P connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::REJECT, strCommand, (unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash)); + } if (nDoS > 0) { Misbehaving(pfrom->GetId(), nDoS); } @@ -3503,8 +3511,10 @@ static bool SendRejectsAndCheckIfBanned(CNode* pnode, CConnman* connman) AssertLockHeld(cs_main); CNodeState &state = *State(pnode->GetId()); - for (const CBlockReject& reject : state.rejects) { - connman->PushMessage(pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, (std::string)NetMsgType::BLOCK, reject.chRejectCode, reject.strRejectReason, reject.hashBlock)); + if (g_enable_bip61) { + for (const CBlockReject& reject : state.rejects) { + connman->PushMessage(pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, (std::string)NetMsgType::BLOCK, reject.chRejectCode, reject.strRejectReason, reject.hashBlock)); + } } state.rejects.clear(); @@ -3622,7 +3632,9 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic& inter } catch (const std::ios_base::failure& e) { - connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, std::string("error parsing message"))); + if (g_enable_bip61) { + connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, std::string("error parsing message"))); + } if (strstr(e.what(), "end of data")) { // Allow exceptions from under-length message on vRecv diff --git a/src/net_processing.h b/src/net_processing.h index 1688158e1b..8b822d9ecb 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -37,6 +37,11 @@ static constexpr int64_t EXTRA_PEER_CHECK_INTERVAL = 45; /** Minimum time an outbound-peer-eviction candidate must be connected for, in order to evict, in seconds */ static constexpr int64_t MINIMUM_CONNECT_TIME = 30; +/** Default for BIP61 (sending reject messages) */ +static constexpr bool DEFAULT_ENABLE_BIP61 = true; +/** Enable BIP61 (sending reject messages) */ +extern bool g_enable_bip61; + class PeerLogicValidation : public CValidationInterface, public NetEventsInterface { private: CConnman* const connman; diff --git a/src/privatesend/privatesend-client.cpp b/src/privatesend/privatesend-client.cpp index 5356e3196a..f83f528892 100644 --- a/src/privatesend/privatesend-client.cpp +++ b/src/privatesend/privatesend-client.cpp @@ -39,7 +39,11 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string& if (strCommand == NetMsgType::DSQUEUE) { if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { LogPrint(BCLog::PRIVATESEND, "DSQUEUE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + } return; } @@ -135,7 +139,11 @@ void CPrivateSendClientSession::ProcessMessage(CNode* pfrom, const std::string& if (strCommand == NetMsgType::DSSTATUSUPDATE) { if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { LogPrint(BCLog::PRIVATESEND, "DSSTATUSUPDATE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + } return; } @@ -172,7 +180,11 @@ void CPrivateSendClientSession::ProcessMessage(CNode* pfrom, const std::string& } else if (strCommand == NetMsgType::DSFINALTX) { if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { LogPrint(BCLog::PRIVATESEND, "DSFINALTX -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + } return; } @@ -198,7 +210,11 @@ void CPrivateSendClientSession::ProcessMessage(CNode* pfrom, const std::string& } else if (strCommand == NetMsgType::DSCOMPLETE) { if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { LogPrint(BCLog::PRIVATESEND, "DSCOMPLETE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + } return; } diff --git a/src/privatesend/privatesend-server.cpp b/src/privatesend/privatesend-server.cpp index d92221cfb6..899c61dfb3 100644 --- a/src/privatesend/privatesend-server.cpp +++ b/src/privatesend/privatesend-server.cpp @@ -33,7 +33,11 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm if (strCommand == NetMsgType::DSACCEPT) { if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { LogPrint(BCLog::PRIVATESEND, "DSACCEPT -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + } PushStatus(pfrom, STATUS_REJECTED, ERR_VERSION, connman); return; } @@ -101,7 +105,11 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm } else if (strCommand == NetMsgType::DSQUEUE) { if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { LogPrint(BCLog::PRIVATESEND, "DSQUEUE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + } return; } @@ -161,7 +169,11 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm } else if (strCommand == NetMsgType::DSVIN) { if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { LogPrint(BCLog::PRIVATESEND, "DSVIN -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + } PushStatus(pfrom, STATUS_REJECTED, ERR_VERSION, connman); return; } @@ -192,7 +204,11 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm } else if (strCommand == NetMsgType::DSSIGNFINALTX) { if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { LogPrint(BCLog::PRIVATESEND, "DSSIGNFINALTX -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion); - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + if (g_enable_bip61) { + connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, + REJECT_OBSOLETE, strprintf( + "Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + } return; } diff --git a/test/functional/invalidtxrequest.py b/test/functional/invalidtxrequest.py index 5792af2abe..ff7ec4e29f 100755 --- a/test/functional/invalidtxrequest.py +++ b/test/functional/invalidtxrequest.py @@ -21,6 +21,9 @@ from test_framework.util import ( wait_until, ) + +REJECT_INVALID = 16 + class InvalidTxRequestTest(BitcoinTestFramework): def set_test_params(self): @@ -81,7 +84,7 @@ class InvalidTxRequestTest(BitcoinTestFramework): # and we get disconnected immediately self.log.info('Test a transaction that is rejected') tx1 = create_transaction(block1.vtx[0], 0, b'\x64', 50 * COIN) - node.p2p.send_txs_and_test([tx1], node, success=False, expect_disconnect=True) + node.p2p.send_txs_and_test([tx1], node, success=False, expect_disconnect=True, reject_code=REJECT_INVALID, reject_reason=b'mandatory-script-verify-flag-failed (Invalid OP_IF construction)') # Make two p2p connections to provide the node with orphans # * p2ps[0] will send valid orphan txs (one with low fee) @@ -90,7 +93,17 @@ class InvalidTxRequestTest(BitcoinTestFramework): self.log.info('Test orphan transaction handling ... ') self.test_orphan_tx_handling(block1.vtx[0].sha256, False) - node.generate(1) # Clear mempool + + # restart node with sending BIP61 messages disabled, check that it disconnects without sending the reject message + self.log.info('Test a transaction that is rejected, with BIP61 disabled') + self.restart_node(0, ['-enablebip61=0','-persistmempool=0']) + self.reconnect_p2p(num_connections=1) + node.p2p.send_txs_and_test([tx1], node, success=False, expect_disconnect=True) + # send_txs_and_test will have waited for disconnect, so we can safely check that no reject has been received + assert_equal(node.p2p.reject_code_received, None) + + self.log.info('Test orphan transaction handling, resolve via block') + self.restart_node(0, ['-persistmempool=0']) self.reconnect_p2p(num_connections=2) self.test_orphan_tx_handling(block2.vtx[0].sha256, True)