diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-05-30 15:47:20 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-05-30 15:46:06 -0400 |
commit | fa36aa79655f7ec76043976f3c1c207afa9bfd6f (patch) | |
tree | 3338ddf2c9a37d04f8cdd2adc2a20ebd51492978 /src/test/script_standard_tests.cpp | |
parent | 61fcef0f89c4eb313b94a93880d7638b90aa0764 (diff) |
wallet: Prevent segfault when sending to unspendable witness
Diffstat (limited to 'src/test/script_standard_tests.cpp')
-rw-r--r-- | src/test/script_standard_tests.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/script_standard_tests.cpp b/src/test/script_standard_tests.cpp index ff0bf6c66d..7ab0978228 100644 --- a/src/test/script_standard_tests.cpp +++ b/src/test/script_standard_tests.cpp @@ -726,6 +726,32 @@ BOOST_AUTO_TEST_CASE(script_standard_IsMine) BOOST_CHECK(!isInvalid); } + // witness unspendable + { + CBasicKeyStore keystore; + keystore.AddKey(keys[0]); + + scriptPubKey.clear(); + scriptPubKey << OP_0 << ToByteVector(ParseHex("aabb")); + + result = IsMine(keystore, scriptPubKey, isInvalid); + BOOST_CHECK_EQUAL(result, ISMINE_NO); + BOOST_CHECK(!isInvalid); + } + + // witness unknown + { + CBasicKeyStore keystore; + keystore.AddKey(keys[0]); + + scriptPubKey.clear(); + scriptPubKey << OP_16 << ToByteVector(ParseHex("aabb")); + + result = IsMine(keystore, scriptPubKey, isInvalid); + BOOST_CHECK_EQUAL(result, ISMINE_NO); + BOOST_CHECK(!isInvalid); + } + // Nonstandard { CBasicKeyStore keystore; |