diff options
| author | Gregory Maxwell <[email protected]> | 2013-09-12 20:50:32 -0700 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2013-09-12 20:50:32 -0700 |
| commit | 4c5969b367d2b8582abc3b0018e18456a7377497 (patch) | |
| tree | 6093f15e6df1d939a1ee746d3f9f9bfb54ee1490 /src/bitcoinrpc.cpp | |
| parent | Merge pull request #2979 from luke-jr/autoconf (diff) | |
| parent | Make validateaddress provide redeemScript (diff) | |
| download | discoin-4c5969b367d2b8582abc3b0018e18456a7377497.tar.xz discoin-4c5969b367d2b8582abc3b0018e18456a7377497.zip | |
Merge pull request #2830 from petertodd/p2sh-rpc
P2SH related RPC improvements
Diffstat (limited to 'src/bitcoinrpc.cpp')
| -rw-r--r-- | src/bitcoinrpc.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 47c738356..d1082c7ec 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -113,6 +113,34 @@ std::string HexBits(unsigned int nBits) return HexStr(BEGIN(uBits.cBits), END(uBits.cBits)); } +uint256 ParseHashV(const Value& v, string strName) +{ + string strHex; + if (v.type() == str_type) + strHex = v.get_str(); + if (!IsHex(strHex)) // Note: IsHex("") is false + throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')"); + uint256 result; + result.SetHex(strHex); + return result; +} +uint256 ParseHashO(const Object& o, string strKey) +{ + return ParseHashV(find_value(o, strKey), strKey); +} +vector<unsigned char> ParseHexV(const Value& v, string strName) +{ + string strHex; + if (v.type() == str_type) + strHex = v.get_str(); + if (!IsHex(strHex)) + throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')"); + return ParseHex(strHex); +} +vector<unsigned char> ParseHexO(const Object& o, string strKey) +{ + return ParseHexV(find_value(o, strKey), strKey); +} /// @@ -252,6 +280,7 @@ static const CRPCCommand vRPCCommands[] = { "getrawtransaction", &getrawtransaction, false, false }, { "createrawtransaction", &createrawtransaction, false, false }, { "decoderawtransaction", &decoderawtransaction, false, false }, + { "decodescript", &decodescript, false, false }, { "signrawtransaction", &signrawtransaction, false, false }, { "sendrawtransaction", &sendrawtransaction, false, false }, { "gettxoutsetinfo", &gettxoutsetinfo, true, false }, |