diff options
Diffstat (limited to 'test/functional/p2p_permissions.py')
-rwxr-xr-x | test/functional/p2p_permissions.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/functional/p2p_permissions.py b/test/functional/p2p_permissions.py index 80a27943fd..c37061c307 100755 --- a/test/functional/p2p_permissions.py +++ b/test/functional/p2p_permissions.py @@ -14,8 +14,10 @@ from test_framework.p2p import P2PDataStore from test_framework.test_node import ErrorMatch from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( + append_config, assert_equal, p2p_port, + tor_port, ) from test_framework.wallet import MiniWallet @@ -57,11 +59,14 @@ class P2PPermissionsTests(BitcoinTestFramework): # by modifying the configuration file. ip_port = "127.0.0.1:{}".format(p2p_port(1)) self.nodes[1].replace_in_config([("bind=127.0.0.1", "whitebind=bloomfilter,forcerelay@" + ip_port)]) + # Explicitly bind the tor port to prevent collisions with the default tor port + append_config(self.nodes[1].datadir_path, [f"bind=127.0.0.1:{tor_port(self.nodes[1].index)}=onion"]) self.checkpermission( ["-whitelist=noban@127.0.0.1"], # Check parameter interaction forcerelay should activate relay ["noban", "bloomfilter", "forcerelay", "relay", "download"]) self.nodes[1].replace_in_config([("whitebind=bloomfilter,forcerelay@" + ip_port, "bind=127.0.0.1")]) + self.nodes[1].replace_in_config([(f"bind=127.0.0.1:{tor_port(self.nodes[1].index)}=onion", "")]) self.checkpermission( # legacy whitelistrelay should be ignored @@ -119,14 +124,17 @@ class P2PPermissionsTests(BitcoinTestFramework): self.log.debug("Check that node[1] will not send an invalid tx to node[0]") tx.vout[0].nValue += 1 + # add dust to cause policy rejection but no disconnection + tx.vout.append(tx.vout[0]) + tx.vout[-1].nValue = 0 txid = tx.rehash() # Send the transaction twice. The first time, it'll be rejected by ATMP because it conflicts - # with a mempool transaction. The second time, it'll be in the m_recent_rejects filter. + # with a mempool transaction. The second time, it'll be in the m_lazy_recent_rejects filter. p2p_rebroadcast_wallet.send_txs_and_test( [tx], self.nodes[1], success=False, - reject_reason='{} (wtxid={}) from peer=0 was not accepted: txn-mempool-conflict'.format(txid, tx.getwtxid()) + reject_reason='{} (wtxid={}) from peer=0 was not accepted: dust'.format(txid, tx.getwtxid()) ) p2p_rebroadcast_wallet.send_txs_and_test( @@ -147,4 +155,4 @@ class P2PPermissionsTests(BitcoinTestFramework): if __name__ == '__main__': - P2PPermissionsTests().main() + P2PPermissionsTests(__file__).main() |