From c2711e4230d9a423ead24f6609691fb338b1d26b Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 6 Apr 2020 15:50:25 -0400 Subject: [PATCH] Avoid dumpprivkey in wallet_listsinceblock.py Generate a privkey in the test framework instead of using dumpprivkey so that descriptor wallets work in this test. --- test/functional/wallet_listsinceblock.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py index 09a336b76..07c14db6b 100755 --- a/test/functional/wallet_listsinceblock.py +++ b/test/functional/wallet_listsinceblock.py @@ -4,6 +4,8 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the listsinceblock RPC.""" +from test_framework.address import key_to_p2wpkh +from test_framework.key import ECKey from test_framework.test_framework import BitcoinTestFramework from test_framework.messages import BIP125_SEQUENCE_NUMBER from test_framework.util import ( @@ -11,6 +13,7 @@ from test_framework.util import ( assert_equal, assert_raises_rpc_error, ) +from test_framework.wallet_util import bytes_to_wif from decimal import Decimal @@ -181,15 +184,21 @@ class ListSinceBlockTest(BitcoinTestFramework): self.sync_all() + # share utxo between nodes[1] and nodes[2] + eckey = ECKey() + eckey.generate() + privkey = bytes_to_wif(eckey.get_bytes()) + address = key_to_p2wpkh(eckey.get_pubkey().get_bytes()) + self.nodes[2].sendtoaddress(address, 10) + self.nodes[2].generate(6) + self.nodes[2].importprivkey(privkey) + utxos = self.nodes[2].listunspent() + utxo = [u for u in utxos if u["address"] == address][0] + self.nodes[1].importprivkey(privkey) + # Split network into two self.split_network() - # share utxo between nodes[1] and nodes[2] - utxos = self.nodes[2].listunspent() - utxo = utxos[0] - privkey = self.nodes[2].dumpprivkey(utxo['address']) - self.nodes[1].importprivkey(privkey) - # send from nodes[1] using utxo to nodes[0] change = '%.8f' % (float(utxo['amount']) - 1.0003) recipient_dict = {