Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_permissions.py
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | def check_tx_relay(self): | ||||
"Check that node[1] will send the tx to node[0] even though it" | "Check that node[1] will send the tx to node[0] even though it" | ||||
" is already in the mempool") | " is already in the mempool") | ||||
connect_nodes(self.nodes[1], self.nodes[0]) | connect_nodes(self.nodes[1], self.nodes[0]) | ||||
with self.nodes[1].assert_debug_log( | with self.nodes[1].assert_debug_log( | ||||
["Force relaying tx {} from whitelisted peer=0".format(txid)]): | ["Force relaying tx {} from whitelisted peer=0".format(txid)]): | ||||
p2p_rebroadcast_wallet.send_txs_and_test([tx], self.nodes[1]) | p2p_rebroadcast_wallet.send_txs_and_test([tx], self.nodes[1]) | ||||
wait_until(lambda: txid in self.nodes[0].getrawmempool()) | wait_until(lambda: txid in self.nodes[0].getrawmempool()) | ||||
self.log.debug( | |||||
"Check that node[1] will not send an invalid tx to node[0]") | |||||
tx.vout[0].nValue += 1 | |||||
txid = tx.rehash() | |||||
p2p_rebroadcast_wallet.send_txs_and_test( | |||||
[tx], | |||||
self.nodes[1], | |||||
success=False, | |||||
reject_reason='Not relaying non-mempool transaction ' | |||||
'{} from whitelisted peer=0'.format(txid), | |||||
) | |||||
def checkpermission(self, args, expectedPermissions, whitelisted): | def checkpermission(self, args, expectedPermissions, whitelisted): | ||||
self.restart_node(1, args) | self.restart_node(1, args) | ||||
connect_nodes(self.nodes[0], self.nodes[1]) | connect_nodes(self.nodes[0], self.nodes[1]) | ||||
peerinfo = self.nodes[1].getpeerinfo()[0] | peerinfo = self.nodes[1].getpeerinfo()[0] | ||||
assert_equal(peerinfo['whitelisted'], whitelisted) | assert_equal(peerinfo['whitelisted'], whitelisted) | ||||
assert_equal(len(expectedPermissions), len(peerinfo['permissions'])) | assert_equal(len(expectedPermissions), len(peerinfo['permissions'])) | ||||
for p in expectedPermissions: | for p in expectedPermissions: | ||||
if p not in peerinfo['permissions']: | if p not in peerinfo['permissions']: | ||||
Show All 12 Lines |