aboutsummaryrefslogtreecommitdiff
path: root/test/functional/segwit.py
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2017-07-10 18:31:57 -0700
committerAndrew Chow <achow101-github@achow101.com>2017-07-27 15:04:00 -0700
commite222dc2aee263bf28cf19689b9c9ed97da054682 (patch)
treede4ea9cb1cb903a0916c7b355cebd98e51545a76 /test/functional/segwit.py
parent9edda0c5f5f20bc6b302ad51fa5ec40ed9da184d (diff)
Replace ismine with producesignature check in witnessifier
Instead of using ismine to check whether an address can be spent by us, make the witness version of the script or address first and then use ProduceSignature with the DummySignatureCreator to check if we can solve for the script. Also fixes test cases to reflect this change.
Diffstat (limited to 'test/functional/segwit.py')
-rwxr-xr-xtest/functional/segwit.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/functional/segwit.py b/test/functional/segwit.py
index ac95d66466..51eaa34a54 100755
--- a/test/functional/segwit.py
+++ b/test/functional/segwit.py
@@ -459,13 +459,14 @@ class SegWitTest(BitcoinTestFramework):
self.mine_and_test_listunspent(unsolvable_after_importaddress, 1)
self.mine_and_test_listunspent(unseen_anytime, 0)
- # addwitnessaddress should refuse to return a witness address if an uncompressed key is used or the address is
- # not in the wallet
+ # addwitnessaddress should refuse to return a witness address if an uncompressed key is used
# note that no witness address should be returned by unsolvable addresses
- # the multisig_without_privkey_address will fail because its keys were not added with importpubkey
- for i in uncompressed_spendable_address + uncompressed_solvable_address + unknown_address + unsolvable_address + [multisig_without_privkey_address]:
+ for i in uncompressed_spendable_address + uncompressed_solvable_address + unknown_address + unsolvable_address:
assert_raises_jsonrpc(-4, "Public key or redeemscript not known to wallet, or the key is uncompressed", self.nodes[0].addwitnessaddress, i)
+ # addwitnessaddress should return a witness addresses even if keys are not in the wallet
+ self.nodes[0].addwitnessaddress(multisig_without_privkey_address)
+
for i in compressed_spendable_address + compressed_solvable_address:
witaddress = self.nodes[0].addwitnessaddress(i)
# addwitnessaddress should return the same address if it is a known P2SH-witness address
@@ -542,7 +543,7 @@ class SegWitTest(BitcoinTestFramework):
# addwitnessaddress should refuse to return a witness address if an uncompressed key is used
# note that a multisig address returned by addmultisigaddress is not solvable until it is added with importaddress
# premature_witaddress are not accepted until the script is added with addwitnessaddress first
- for i in uncompressed_spendable_address + uncompressed_solvable_address + premature_witaddress + [compressed_solvable_address[1]]:
+ for i in uncompressed_spendable_address + uncompressed_solvable_address + premature_witaddress:
# This will raise an exception
assert_raises_jsonrpc(-4, "Public key or redeemscript not known to wallet, or the key is uncompressed", self.nodes[0].addwitnessaddress, i)