File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 4
4
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
5
"""Test the listsinceblock RPC."""
6
6
7
+ from test_framework .address import key_to_p2wpkh
8
+ from test_framework .key import ECKey
7
9
from test_framework .test_framework import BitcoinTestFramework
8
10
from test_framework .messages import BIP125_SEQUENCE_NUMBER
9
11
from test_framework .util import (
10
12
assert_array_result ,
11
13
assert_equal ,
12
14
assert_raises_rpc_error ,
13
15
)
16
+ from test_framework .wallet_util import bytes_to_wif
14
17
15
18
from decimal import Decimal
16
19
@@ -181,15 +184,21 @@ def test_double_spend(self):
181
184
182
185
self .sync_all ()
183
186
184
- # Split network into two
185
- self .split_network ()
186
-
187
187
# share utxo between nodes[1] and nodes[2]
188
+ eckey = ECKey ()
189
+ eckey .generate ()
190
+ privkey = bytes_to_wif (eckey .get_bytes ())
191
+ address = key_to_p2wpkh (eckey .get_pubkey ().get_bytes ())
192
+ self .nodes [2 ].sendtoaddress (address , 10 )
193
+ self .nodes [2 ].generate (6 )
194
+ self .nodes [2 ].importprivkey (privkey )
188
195
utxos = self .nodes [2 ].listunspent ()
189
- utxo = utxos [0 ]
190
- privkey = self .nodes [2 ].dumpprivkey (utxo ['address' ])
196
+ utxo = [u for u in utxos if u ["address" ] == address ][0 ]
191
197
self .nodes [1 ].importprivkey (privkey )
192
198
199
+ # Split network into two
200
+ self .split_network ()
201
+
193
202
# send from nodes[1] using utxo to nodes[0]
194
203
change = '%.8f' % (float (utxo ['amount' ]) - 1.0003 )
195
204
recipient_dict = {
You can’t perform that action at this time.
0 commit comments