From: 0xDEADFACE Date: Thu, 11 Feb 2016 18:19:35 +0000 (-0800) Subject: Add hex representation of public key pair. X-Git-Tag: nvc-v0.5.6~90 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=a4bd78df61a14ec83f4a2f71edb0e18b434a8779 Add hex representation of public key pair. --- diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index ad20062..22beb60 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1870,9 +1870,13 @@ Value newmalleablekey(const Array& params, bool fHelp) malleableKey.MakeNewKeys(); CMalleablePubKey malleablePubKey = malleableKey.GetMalleablePubKey(); + CDataStream ssPublicBytes(SER_NETWORK, PROTOCOL_VERSION); + ssPublicBytes << malleablePubKey; + Object result; result.push_back(Pair("PrivatePair", malleableKey.ToString())); result.push_back(Pair("PublicPair", malleablePubKey.ToString())); + result.push_back(Pair("PublicBytes", HexStr(ssPublicBytes.begin(), ssPublicBytes.end()))); return result; } @@ -1911,8 +1915,14 @@ Value adjustmalleablepubkey(const Array& params, bool fHelp) "adjustmalleablepubkey \n" "Calculate new public key using provided malleable public key data.\n"); + string pubKeyPair = params[0].get_str(); CMalleablePubKey malleablePubKey; - malleablePubKey.SetString(params[0].get_str()); + + if (pubKeyPair.size() == 138) { + CDataStream ssPublicBytes(ParseHex(pubKeyPair), SER_NETWORK, PROTOCOL_VERSION); + ssPublicBytes >> malleablePubKey; + } else + malleablePubKey.SetString(pubKeyPair); CPubKey R, vchPubKeyVariant; malleablePubKey.GetVariant(R, vchPubKeyVariant);