Skip to content

Commit aabc8c8

Browse files
committed
fix: derivation path for cj - add missing /4' (cj purpose)
1 parent 805a7e8 commit aabc8c8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/wallet/rpc/backup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@ RPCHelpMan listdescriptors()
20392039
spk.pushKV("internal", wallet->GetScriptPubKeyMan(true) == desc_spk_man);
20402040
}
20412041
if (type != std::nullopt) {
2042-
std::string match = strprintf("/%d'/%s'/0'", BIP32_PURPOSE_FEATURE, Params().ExtCoinType());
2042+
std::string match = strprintf("/%d'/%s'/4'/0'", BIP32_PURPOSE_FEATURE, Params().ExtCoinType());
20432043
bool is_cj = descriptor.find(match) != std::string::npos;
20442044
if (is_cj) {
20452045
spk.pushKV("internal", false);

src/wallet/scriptpubkeyman.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2100,8 +2100,10 @@ bool DescriptorScriptPubKeyMan::SetupDescriptorGeneration(const CExtKey& master_
21002100

21012101
// Build descriptor string
21022102
std::string desc_prefix = strprintf("pkh(%s/%d'/%d'", xpub, type == PathDerivationType::DIP0009_CoinJoin ? BIP32_PURPOSE_FEATURE : BIP32_PURPOSE_STANDARD, Params().ExtCoinType());
2103+
if (type == PathDerivationType::DIP0009_CoinJoin) {
2104+
desc_prefix += "/4'";
2105+
}
21032106
std::string desc_suffix = "/*)";
2104-
21052107
std::string internal_path = (type == PathDerivationType::BIP44_Internal) ? "/1" : "/0";
21062108
std::string desc_str = desc_prefix + "/0'" + internal_path + desc_suffix;
21072109

0 commit comments

Comments
 (0)