@@ -57,29 +57,33 @@ def run_test(self):
57
57
self .nodes [0 ].p2p .wait_for_tx (txid )
58
58
assert_equal (self .nodes [0 ].getmempoolinfo ()['size' ], 1 )
59
59
60
- self .log .info ('Check that txs from forcerelay peers are not rejected and relayed to others' )
61
- self .log .info ("Restarting node 0 with forcerelay permission and blocksonly" )
62
- self .restart_node (0 , ["-persistmempool=0" , "-whitelist=127.0.0.1" , "-whitelistforcerelay " , "-blocksonly" ])
60
+ self .log .info ('Check that txs from peers with relay-permission are not rejected and relayed to others' )
61
+ self .log .info ("Restarting node 0 with relay permission and blocksonly" )
62
+ self .restart_node (0 , ["-persistmempool=0" , "-whitelist=relay@ 127.0.0.1" , "-blocksonly" ])
63
63
assert_equal (self .nodes [0 ].getrawmempool (), [])
64
64
first_peer = self .nodes [0 ].add_p2p_connection (P2PInterface ())
65
65
second_peer = self .nodes [0 ].add_p2p_connection (P2PInterface ())
66
66
peer_1_info = self .nodes [0 ].getpeerinfo ()[0 ]
67
- assert_equal (peer_1_info ['whitelisted' ], True )
68
- assert_equal (peer_1_info ['permissions' ], ['noban' , 'forcerelay' , 'relay' , 'mempool' , 'download' ])
67
+ assert_equal (peer_1_info ['permissions' ], ['relay' ])
69
68
peer_2_info = self .nodes [0 ].getpeerinfo ()[1 ]
70
- assert_equal (peer_2_info ['whitelisted' ], True )
71
- assert_equal (peer_2_info ['permissions' ], ['noban' , 'forcerelay' , 'relay' , 'mempool' , 'download' ])
69
+ assert_equal (peer_2_info ['permissions' ], ['relay' ])
72
70
assert_equal (self .nodes [0 ].testmempoolaccept ([sigtx ])[0 ]['allowed' ], True )
73
71
txid = self .nodes [0 ].testmempoolaccept ([sigtx ])[0 ]['txid' ]
74
72
75
- self .log .info ('Check that the tx from forcerelay first_peer is relayed to others (ie.second_peer)' )
73
+ self .log .info ('Check that the tx from first_peer with relay-permission is relayed to others (ie.second_peer)' )
76
74
with self .nodes [0 ].assert_debug_log (["received getdata" ]):
75
+ # Note that normally, first_peer would never send us transactions since we're a blocksonly node.
76
+ # By activating blocksonly, we explicitly tell our peers that they should not send us transactions,
77
+ # and Bitcoin Core respects that choice and will not send transactions.
78
+ # But if, for some reason, first_peer decides to relay transactions to us anyway, we should relay them to
79
+ # second_peer since we gave relay permission to first_peer.
80
+ # See https://github.com/bitcoin/bitcoin/issues/19943 for details.
77
81
first_peer .send_message (msg_tx (FromHex (CTransaction (), sigtx )))
78
- self .log .info ('Check that the forcerelay peer is still connected after sending the transaction' )
82
+ self .log .info ('Check that the peer with relay-permission is still connected after sending the transaction' )
79
83
assert_equal (first_peer .is_connected , True )
80
84
second_peer .wait_for_tx (txid )
81
85
assert_equal (self .nodes [0 ].getmempoolinfo ()['size' ], 1 )
82
- self .log .info ("Forcerelay peer's transaction is accepted and relayed" )
86
+ self .log .info ("Relay-permission peer's transaction is accepted and relayed" )
83
87
84
88
85
89
if __name__ == '__main__' :
0 commit comments