@@ -356,8 +356,10 @@ def run_test(self):
356
356
[p2wpkh , p2sh_p2wpkh , p2pk , p2pkh , p2sh_p2pk , p2sh_p2pkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ] = self .p2pkh_address_to_script (v )
357
357
# normal P2PKH and P2PK with compressed keys should always be spendable
358
358
spendable_anytime .extend ([p2pkh , p2pk ])
359
- # P2SH_P2PK, P2SH_P2PKH, and witness with compressed keys are spendable after direct importaddress
360
- spendable_after_importaddress .extend ([p2wpkh , p2sh_p2wpkh , p2sh_p2pk , p2sh_p2pkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ])
359
+ # P2SH_P2PK, P2SH_P2PKH with compressed keys are spendable after direct importaddress
360
+ spendable_after_importaddress .extend ([p2sh_p2pk , p2sh_p2pkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ])
361
+ # P2WPKH and P2SH_P2WPKH with compressed keys should always be spendable
362
+ spendable_anytime .extend ([p2wpkh , p2sh_p2wpkh ])
361
363
362
364
for i in uncompressed_spendable_address :
363
365
v = self .nodes [0 ].validateaddress (i )
@@ -373,7 +375,7 @@ def run_test(self):
373
375
spendable_anytime .extend ([p2pkh , p2pk ])
374
376
# P2SH_P2PK and P2SH_P2PKH are spendable after direct importaddress
375
377
spendable_after_importaddress .extend ([p2sh_p2pk , p2sh_p2pkh ])
376
- # witness with uncompressed keys are never seen
378
+ # Witness output types with uncompressed keys are never seen
377
379
unseen_anytime .extend ([p2wpkh , p2sh_p2wpkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ])
378
380
379
381
for i in compressed_solvable_address :
@@ -384,10 +386,10 @@ def run_test(self):
384
386
solvable_after_importaddress .extend ([bare , p2sh , p2wsh , p2sh_p2wsh ])
385
387
else :
386
388
[p2wpkh , p2sh_p2wpkh , p2pk , p2pkh , p2sh_p2pk , p2sh_p2pkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ] = self .p2pkh_address_to_script (v )
387
- # normal P2PKH and P2PK with compressed keys should always be seen
388
- solvable_anytime .extend ([p2pkh , p2pk ])
389
- # P2SH_P2PK, P2SH_P2PKH, and witness with compressed keys are seen after direct importaddress
390
- solvable_after_importaddress .extend ([p2wpkh , p2sh_p2wpkh , p2sh_p2pk , p2sh_p2pkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ])
389
+ # normal P2PKH, P2PK, P2WPKH and P2SH_P2WPKH with compressed keys should always be seen
390
+ solvable_anytime .extend ([p2pkh , p2pk , p2wpkh , p2sh_p2wpkh ])
391
+ # P2SH_P2PK, P2SH_P2PKH with compressed keys are seen after direct importaddress
392
+ solvable_after_importaddress .extend ([p2sh_p2pk , p2sh_p2pkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ])
391
393
392
394
for i in uncompressed_solvable_address :
393
395
v = self .nodes [0 ].validateaddress (i )
@@ -403,7 +405,7 @@ def run_test(self):
403
405
solvable_anytime .extend ([p2pkh , p2pk ])
404
406
# P2SH_P2PK, P2SH_P2PKH with uncompressed keys are seen after direct importaddress
405
407
solvable_after_importaddress .extend ([p2sh_p2pk , p2sh_p2pkh ])
406
- # witness with uncompressed keys are never seen
408
+ # Witness output types with uncompressed keys are never seen
407
409
unseen_anytime .extend ([p2wpkh , p2sh_p2wpkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ])
408
410
409
411
op1 = CScript ([OP_1 ])
@@ -496,6 +498,8 @@ def run_test(self):
496
498
spendable_after_addwitnessaddress = [] # These outputs should be seen after importaddress
497
499
solvable_after_addwitnessaddress = [] # These outputs should be seen after importaddress but not spendable
498
500
unseen_anytime = [] # These outputs should never be seen
501
+ solvable_anytime = [] # These outputs should be solvable after importpubkey
502
+ unseen_anytime = [] # These outputs should never be seen
499
503
500
504
uncompressed_spendable_address .append (self .nodes [0 ].addmultisigaddress (2 , [uncompressed_spendable_address [0 ], compressed_spendable_address [0 ]]))
501
505
uncompressed_spendable_address .append (self .nodes [0 ].addmultisigaddress (2 , [uncompressed_spendable_address [0 ], uncompressed_spendable_address [0 ]]))
@@ -514,9 +518,8 @@ def run_test(self):
514
518
premature_witaddress .append (script_to_p2sh (p2wsh ))
515
519
else :
516
520
[p2wpkh , p2sh_p2wpkh , p2pk , p2pkh , p2sh_p2pk , p2sh_p2pkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ] = self .p2pkh_address_to_script (v )
517
- # P2WPKH, P2SH_P2WPKH are spendable after addwitnessaddress
518
- spendable_after_addwitnessaddress .extend ([p2wpkh , p2sh_p2wpkh ])
519
- premature_witaddress .append (script_to_p2sh (p2wpkh ))
521
+ # P2WPKH, P2SH_P2WPKH are always spendable
522
+ spendable_anytime .extend ([p2wpkh , p2sh_p2wpkh ])
520
523
521
524
for i in uncompressed_spendable_address + uncompressed_solvable_address :
522
525
v = self .nodes [0 ].validateaddress (i )
@@ -538,10 +541,11 @@ def run_test(self):
538
541
premature_witaddress .append (script_to_p2sh (p2wsh ))
539
542
else :
540
543
[p2wpkh , p2sh_p2wpkh , p2pk , p2pkh , p2sh_p2pk , p2sh_p2pkh , p2wsh_p2pk , p2wsh_p2pkh , p2sh_p2wsh_p2pk , p2sh_p2wsh_p2pkh ] = self .p2pkh_address_to_script (v )
541
- # P2SH_P2PK, P2SH_P2PKH with compressed keys are seen after addwitnessaddress
542
- solvable_after_addwitnessaddress .extend ([p2wpkh , p2sh_p2wpkh ])
543
- premature_witaddress .append (script_to_p2sh (p2wpkh ))
544
+ # P2SH_P2PK, P2SH_P2PKH with compressed keys are always solvable
545
+ solvable_anytime .extend ([p2wpkh , p2sh_p2wpkh ])
544
546
547
+ self .mine_and_test_listunspent (spendable_anytime , 2 )
548
+ self .mine_and_test_listunspent (solvable_anytime , 1 )
545
549
self .mine_and_test_listunspent (spendable_after_addwitnessaddress + solvable_after_addwitnessaddress + unseen_anytime , 0 )
546
550
547
551
# addwitnessaddress should refuse to return a witness address if an uncompressed key is used
@@ -558,8 +562,8 @@ def run_test(self):
558
562
witaddress = self .nodes [0 ].addwitnessaddress (i )
559
563
assert_equal (witaddress , self .nodes [0 ].addwitnessaddress (witaddress ))
560
564
561
- spendable_txid .append (self .mine_and_test_listunspent (spendable_after_addwitnessaddress , 2 ))
562
- solvable_txid .append (self .mine_and_test_listunspent (solvable_after_addwitnessaddress , 1 ))
565
+ spendable_txid .append (self .mine_and_test_listunspent (spendable_after_addwitnessaddress + spendable_anytime , 2 ))
566
+ solvable_txid .append (self .mine_and_test_listunspent (solvable_after_addwitnessaddress + solvable_anytime , 1 ))
563
567
self .mine_and_test_listunspent (unseen_anytime , 0 )
564
568
565
569
# Check that createrawtransaction/decoderawtransaction with non-v0 Bech32 works
0 commit comments