aboutsummaryrefslogtreecommitdiff
path: root/src/script/standard.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/standard.h')
-rw-r--r--src/script/standard.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/script/standard.h b/src/script/standard.h
index 5925f2a512..3b2838a5bb 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
@@ -144,6 +155,10 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
* addressRet is populated with a single value and nRequiredRet is set to 1.
* Returns true if successful. Currently does not extract address from
* pay-to-witness scripts.
+ *
+ * Note: this function confuses destinations (a subset of CScripts that are
+ * encodable as an address) with key identifiers (of keys involved in a
+ * CScript), and its use should be phased out.
*/
bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
@@ -164,6 +179,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);