mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge #13351: wallet: Prevent segfault when sending to unspendable witness
fa36aa7965
wallet: Prevent segfault when sending to unspendable witness (MarcoFalke) Pull request description: Previously we wouldn't care about the `txnouttype`, but after4e91820531
we `switch` on the type. Tree-SHA512: 6b597aba80cb43881671ad7b3a4ad97753864e8005a05c23fdd8ee79953483c08f241b5c392a9b494298eadc5cfba895b0480d916ef4f11d122fd6196f31b84a
This commit is contained in:
commit
2140f6cbc5
@ -114,6 +114,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::v
|
||||
vSolutionsRet.push_back(std::move(witnessprogram));
|
||||
return true;
|
||||
}
|
||||
typeRet = TX_NONSTANDARD;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user