Skip to content

Commit

Permalink
Avoid dumpprivkey in wallet_listsinceblock.py
Browse files Browse the repository at this point in the history
Generate a privkey in the test framework instead of using dumpprivkey so
that descriptor wallets work in this test.
  • Loading branch information
achow101 committed Nov 1, 2020
1 parent 553dbf9 commit c2711e4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions test/functional/wallet_listsinceblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
# 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 (
assert_array_result,
assert_equal,
assert_raises_rpc_error,
)
from test_framework.wallet_util import bytes_to_wif

from decimal import Decimal

Expand Down Expand Up @@ -181,15 +184,21 @@ def test_double_spend(self):

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 = {
Expand Down

0 comments on commit c2711e4

Please sign in to comment.