diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-11-30 16:48:38 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2018-01-03 05:43:06 -0800 |
commit | 985c79552ceb6a5f5812d421dc5c86fa3b1cc41d (patch) | |
tree | 682a791059736fe9e74a5314df7536f576e16645 /src/script/standard.h | |
parent | cbe197470ecc1f7b48771c4e7b654ab030af4c9e (diff) |
Improve witness destination types and use them more
Diffstat (limited to 'src/script/standard.h')
-rw-r--r-- | src/script/standard.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/script/standard.h b/src/script/standard.h index 3eeeabdc15..b1c314fa72 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -73,8 +73,19 @@ public: friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; } }; -struct WitnessV0ScriptHash : public uint256 {}; -struct WitnessV0KeyHash : public uint160 {}; +struct WitnessV0ScriptHash : public uint256 +{ + WitnessV0ScriptHash() : uint256() {} + explicit WitnessV0ScriptHash(const uint256& hash) : uint256(hash) {} + using uint256::uint256; +}; + +struct WitnessV0KeyHash : public uint160 +{ + WitnessV0KeyHash() : uint160() {} + explicit WitnessV0KeyHash(const uint160& hash) : uint160(hash) {} + using uint160::uint160; +}; //! CTxDestination subtype to encode any future Witness version struct WitnessUnknown @@ -164,6 +175,9 @@ CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys); * Generate a pay-to-witness script for the given redeem script. If the redeem * script is P2PK or P2PKH, this returns a P2WPKH script, otherwise it returns a * P2WSH script. + * + * TODO: replace calls to GetScriptForWitness with GetScriptForDestination using + * the various witness-specific CTxDestination subtypes. */ CScript GetScriptForWitness(const CScript& redeemscript); |