Skip to content

Commit 55057ff

Browse files
committed
rpc: deduplicate WriteHDKeypath() used in decodepsbt
The functionality is already provided in the BIP32 utility library util/bip32.h with the exact same name and function signature.
1 parent 476436b commit 55057ff

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <script/signingprovider.h>
2929
#include <script/standard.h>
3030
#include <uint256.h>
31+
#include <util/bip32.h>
3132
#include <util/moneystr.h>
3233
#include <util/strencodings.h>
3334
#include <util/string.h>
@@ -938,25 +939,6 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
938939
return result;
939940
}
940941

941-
static std::string WriteHDKeypath(std::vector<uint32_t>& keypath)
942-
{
943-
std::string keypath_str = "m";
944-
for (uint32_t num : keypath) {
945-
keypath_str += "/";
946-
bool hardened = false;
947-
if (num & 0x80000000) {
948-
hardened = true;
949-
num &= ~0x80000000;
950-
}
951-
952-
keypath_str += ToString(num);
953-
if (hardened) {
954-
keypath_str += "'";
955-
}
956-
}
957-
return keypath_str;
958-
}
959-
960942
UniValue decodepsbt(const JSONRPCRequest& request)
961943
{
962944
RPCHelpMan{"decodepsbt",

0 commit comments

Comments
 (0)