diff options
| author | Wladimir J. van der Laan <[email protected]> | 2017-02-14 14:24:27 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-02-14 14:32:22 +0100 |
| commit | edc9e63c57992a839614dd2f9a54f77fdbffb6ab (patch) | |
| tree | 0330a67aa73f8d590e360feadffe5146197e2f37 /src/rpc | |
| parent | Merge #9735: devtools: Handle Qt formatting characters edge-case in update-tr... (diff) | |
| parent | Use MTP for importmulti "now" timestamps (diff) | |
| download | discoin-edc9e63c57992a839614dd2f9a54f77fdbffb6ab.tar.xz discoin-edc9e63c57992a839614dd2f9a54f77fdbffb6ab.zip | |
Merge #9682: Require timestamps for importmulti keys
266a811 Use MTP for importmulti "now" timestamps (Russell Yanofsky)
3cf9917 Add test to check new importmulti "now" value (Russell Yanofsky)
442887f Require timestamps for importmulti keys (Russell Yanofsky)
Diffstat (limited to 'src/rpc')
| -rw-r--r-- | src/rpc/misc.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 480c45516..25fad3c2e 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -167,6 +167,7 @@ UniValue validateaddress(const JSONRPCRequest& request) " \"pubkey\" : \"publickeyhex\", (string) The hex value of the raw public key\n" " \"iscompressed\" : true|false, (boolean) If the address is compressed\n" " \"account\" : \"account\" (string) DEPRECATED. The account associated with the address, \"\" is the default account\n" + " \"timestamp\" : timestamp, (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)\n" " \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath if the key is HD and available\n" " \"hdmasterkeyid\" : \"<hash160>\" (string, optional) The Hash160 of the HD master pubkey\n" "}\n" @@ -204,10 +205,16 @@ UniValue validateaddress(const JSONRPCRequest& request) if (pwalletMain && pwalletMain->mapAddressBook.count(dest)) ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest].name)); CKeyID keyID; - if (pwalletMain && address.GetKeyID(keyID) && pwalletMain->mapKeyMetadata.count(keyID) && !pwalletMain->mapKeyMetadata[keyID].hdKeypath.empty()) - { - ret.push_back(Pair("hdkeypath", pwalletMain->mapKeyMetadata[keyID].hdKeypath)); - ret.push_back(Pair("hdmasterkeyid", pwalletMain->mapKeyMetadata[keyID].hdMasterKeyID.GetHex())); + if (pwalletMain) { + const auto& meta = pwalletMain->mapKeyMetadata; + auto it = address.GetKeyID(keyID) ? meta.find(keyID) : meta.end(); + if (it != meta.end()) { + ret.push_back(Pair("timestamp", it->second.nCreateTime)); + if (!it->second.hdKeypath.empty()) { + ret.push_back(Pair("hdkeypath", it->second.hdKeypath)); + ret.push_back(Pair("hdmasterkeyid", it->second.hdMasterKeyID.GetHex())); + } + } } #endif } |