aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_filter.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-12-25 21:31:49 +0100
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-12-26 12:10:52 +0100
commite704d4d26f62f83068dc7d4082ab9b57bc33d1fb (patch)
tree33b004fa74e0d44f8111632f6995c95fa1d0e3a4 /test/functional/p2p_filter.py
parent9bec5b80a0f3b134246497b06017bce790ec4444 (diff)
downloadbitcoin-e704d4d26f62f83068dc7d4082ab9b57bc33d1fb.tar.xz
test: introduce `getnewdestination` helper for generating various address types
This serves as a replacement for the getnewaddress RPC if no wallet is available. In addition to the address, it also returns the corresponding public key and output script (scriptPubKey).
Diffstat (limited to 'test/functional/p2p_filter.py')
-rwxr-xr-xtest/functional/p2p_filter.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/functional/p2p_filter.py b/test/functional/p2p_filter.py
index 2192363a89..3cf92b0316 100755
--- a/test/functional/p2p_filter.py
+++ b/test/functional/p2p_filter.py
@@ -31,7 +31,7 @@ from test_framework.script import MAX_SCRIPT_ELEMENT_SIZE
from test_framework.test_framework import BitcoinTestFramework
from test_framework.wallet import (
MiniWallet,
- random_p2wpkh,
+ getnewdestination,
)
@@ -169,14 +169,14 @@ class FilterTest(BitcoinTestFramework):
self.log.info('Check that we only receive a merkleblock if the filter does not match a tx in a block')
filter_peer.tx_received = False
- block_hash = self.generatetoscriptpubkey(random_p2wpkh())
+ block_hash = self.generatetoscriptpubkey(getnewdestination()[1])
filter_peer.wait_for_merkleblock(block_hash)
assert not filter_peer.tx_received
self.log.info('Check that we not receive a tx if the filter does not match a mempool tx')
filter_peer.merkleblock_received = False
filter_peer.tx_received = False
- self.wallet.send_to(from_node=self.nodes[0], scriptPubKey=random_p2wpkh(), amount=7 * COIN)
+ self.wallet.send_to(from_node=self.nodes[0], scriptPubKey=getnewdestination()[1], amount=7 * COIN)
filter_peer.sync_send_with_ping()
assert not filter_peer.merkleblock_received
assert not filter_peer.tx_received
@@ -190,14 +190,14 @@ class FilterTest(BitcoinTestFramework):
self.log.info('Check that after deleting filter all txs get relayed again')
filter_peer.send_and_ping(msg_filterclear())
for _ in range(5):
- txid, _ = self.wallet.send_to(from_node=self.nodes[0], scriptPubKey=random_p2wpkh(), amount=7 * COIN)
+ txid, _ = self.wallet.send_to(from_node=self.nodes[0], scriptPubKey=getnewdestination()[1], amount=7 * COIN)
filter_peer.wait_for_tx(txid)
self.log.info('Check that request for filtered blocks is ignored if no filter is set')
filter_peer.merkleblock_received = False
filter_peer.tx_received = False
with self.nodes[0].assert_debug_log(expected_msgs=['received getdata']):
- block_hash = self.generatetoscriptpubkey(random_p2wpkh())
+ block_hash = self.generatetoscriptpubkey(getnewdestination()[1])
filter_peer.wait_for_inv([CInv(MSG_BLOCK, int(block_hash, 16))])
filter_peer.sync_with_ping()
assert not filter_peer.merkleblock_received