Skip to content

Commit

Permalink
Merge bitcoin#19555: rpc: deduplicate WriteHDKeypath() used in decode…
Browse files Browse the repository at this point in the history
…psbt

55057ff 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 55057ff
  instagibbs:
    utACK bitcoin@55057ff
  jonatack:
    ACK 55057ff

Tree-SHA512: 074c1a71ffb32908926bf07f0c5428a46309f6e0d21e7c20b1008197c820b97776a441736d0b6fd8ab0c0852522a0b5a5ddb26a1e4a1100ca02aabc65a07a018
  • Loading branch information
fanquake committed Jul 21, 2020
2 parents 476436b + 55057ff commit f5000ae
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <script/signingprovider.h>
#include <script/standard.h>
#include <uint256.h>
#include <util/bip32.h>
#include <util/moneystr.h>
#include <util/strencodings.h>
#include <util/string.h>
Expand Down Expand Up @@ -938,25 +939,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",
Expand Down

0 comments on commit f5000ae

Please sign in to comment.