diff options
author | Andrew Chow <achow101-github@achow101.com> | 2020-04-06 15:50:25 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-11-01 17:54:19 -0500 |
commit | c2711e4230d9a423ead24f6609691fb338b1d26b (patch) | |
tree | ec619f95035e5e60fbcd7364fcdc30ef53dcbe0e /test | |
parent | 553dbf9af4dea96e6a3e79bba9607003342029bd (diff) |
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.
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/wallet_listsinceblock.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py index 09a336b764..07c14db6b1 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() - # Split network into two - self.split_network() - # 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 = utxos[0] - privkey = self.nodes[2].dumpprivkey(utxo['address']) + utxo = [u for u in utxos if u["address"] == address][0] self.nodes[1].importprivkey(privkey) + # Split network into two + self.split_network() + # send from nodes[1] using utxo to nodes[0] change = '%.8f' % (float(utxo['amount']) - 1.0003) recipient_dict = { |