Merge #19555: rpc: deduplicate WriteHDKeypath() used in decodepsbt

55057ffc51697daafac1224664d5e3258ae0b116 rpc: deduplicate WriteHDKeypath() used in decodepsbt (Sebastian Falbesoner)

Pull request description:

  The functionality is already provided in the BIP32 utility library `util/bip32.h` with the exact same name and function signature.

ACKs for top commit:
  achow101:
    ACK 55057ffc51697daafac1224664d5e3258ae0b116
  instagibbs:
    utACK 55057ffc51
  jonatack:
    ACK 55057ffc51697daafac1224664d5e3258ae0b116

Tree-SHA512: 074c1a71ffb32908926bf07f0c5428a46309f6e0d21e7c20b1008197c820b97776a441736d0b6fd8ab0c0852522a0b5a5ddb26a1e4a1100ca02aabc65a07a018
This commit is contained in:
fanquake 2020-07-21 08:32:45 +08:00 committed by pasta
parent ae38bd6a52
commit 931e2ad0cd
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -943,25 +943,6 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
return result;
}
static std::string WriteHDKeypath(std::vector<uint32_t>& keypath)
{
std::string keypath_str = "m";
for (uint32_t num : keypath) {
keypath_str += "/";
bool hardened = false;
if (num & 0x80000000) {
hardened = true;
num &= ~0x80000000;
}
keypath_str += ToString(num);
if (hardened) {
keypath_str += "'";
}
}
return keypath_str;
}
UniValue decodepsbt(const JSONRPCRequest& request)
{
RPCHelpMan{"decodepsbt",