diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-08-22 18:02:33 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-09-06 13:07:45 -0700 |
commit | 5c8ff0d448ffdc6340b195ddfa2128d5f21a839b (patch) | |
tree | 63a83a0708303a8d8382739c283bb41e07bdc5fe /src/script | |
parent | 6866b4912b8013ed748d12250209f7079a3c92e6 (diff) |
Introduce wrappers around CBitcoinAddress
This patch removes the need for the intermediary Base58 type
CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination
function that directly operate on the conversion between strings
and CTxDestination.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/standard.cpp | 4 | ||||
-rw-r--r-- | src/script/standard.h | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 2aed393921..b6e2232ab4 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -317,3 +317,7 @@ CScript GetScriptForWitness(const CScript& redeemscript) ret << OP_0 << ToByteVector(hash); return ret; } + +bool IsValidDestination(const CTxDestination& dest) { + return dest.which() != 0; +} diff --git a/src/script/standard.h b/src/script/standard.h index 7619192264..8df143a3a3 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -77,10 +77,13 @@ public: * * CNoDestination: no destination set * * CKeyID: TX_PUBKEYHASH destination * * CScriptID: TX_SCRIPTHASH destination - * A CTxDestination is the internal data type encoded in a CBitcoinAddress + * A CTxDestination is the internal data type encoded in a bitcoin address */ typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination; +/** Check whether a CTxDestination is a CNoDestination. */ +bool IsValidDestination(const CTxDestination& dest); + /** Get the name of a txnouttype as a C string, or nullptr if unknown. */ const char* GetTxnOutputType(txnouttype t); |