mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
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.
This commit is contained in:
parent
476436b2de
commit
55057ffc51
1 changed files with 1 additions and 19 deletions
|
@ -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>
|
||||
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue