mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-28 09:51:31 +02: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
@ -28,6 +28,7 @@
|
|||||||
#include <script/signingprovider.h>
|
#include <script/signingprovider.h>
|
||||||
#include <script/standard.h>
|
#include <script/standard.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
|
#include <util/bip32.h>
|
||||||
#include <util/moneystr.h>
|
#include <util/moneystr.h>
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
@ -938,25 +939,6 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
|
|||||||
return result;
|
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)
|
UniValue decodepsbt(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
RPCHelpMan{"decodepsbt",
|
RPCHelpMan{"decodepsbt",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user