mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 11:57:28 -03:00
Merge #17924: Bug: IsUsedDestination shouldn't use key id as script id for ScriptHash
6dd59d2e49
Don't allow implementers to think ScriptHash(Witness*()) results in nesting computation (Gregory Sanders)4b8f1e989f
IsUsedDestination shouldn't use key id as script id for ScriptHash (Gregory Sanders) Pull request description: Regression introduced in https://github.com/bitcoin/bitcoin/pull/17621 which causes p2sh-segwit addresses to be erroneously missed. Tests are only failing in 0.19 branch, likely because that release still uses p2sh-segwit addresses rather than bech32 by default. I'll devise a test case to catch this going forward. ACKs for top commit: achow101: ACK6dd59d2e49
MarcoFalke: ACK6dd59d2
meshcollider: Code review ACK6dd59d2e49
Tree-SHA512: b3e0f320c97b8c1f814cc386840240cbde2761fee9711617b713d3f75a4a5dce2dff2df573d80873df42a1f4b74e816ab8552a573fa1d62c344997fbb6af9950
This commit is contained in:
commit
f018d0c9cd
2 changed files with 6 additions and 1 deletions
|
@ -80,9 +80,14 @@ struct PKHash : public uint160
|
|||
using uint160::uint160;
|
||||
};
|
||||
|
||||
struct WitnessV0KeyHash;
|
||||
struct ScriptHash : public uint160
|
||||
{
|
||||
ScriptHash() : uint160() {}
|
||||
// These don't do what you'd expect.
|
||||
// Use ScriptHash(GetScriptForDestination(...)) instead.
|
||||
explicit ScriptHash(const WitnessV0KeyHash& hash) = delete;
|
||||
explicit ScriptHash(const PKHash& hash) = delete;
|
||||
explicit ScriptHash(const uint160& hash) : uint160(hash) {}
|
||||
explicit ScriptHash(const CScript& script);
|
||||
using uint160::uint160;
|
||||
|
|
|
@ -744,7 +744,7 @@ bool CWallet::IsUsedDestination(const uint256& hash, unsigned int n) const
|
|||
if (GetDestData(wpkh_dest, "used", nullptr)) {
|
||||
return true;
|
||||
}
|
||||
ScriptHash sh_wpkh_dest(wpkh_dest);
|
||||
ScriptHash sh_wpkh_dest(GetScriptForDestination(wpkh_dest));
|
||||
if (GetDestData(sh_wpkh_dest, "used", nullptr)) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue