Skip to content

Commit

Permalink
Merge pull request #282 from JaredTate/develop
Browse files Browse the repository at this point in the history
Fix 8.22.0 HD Wallet Import Crash Bug
  • Loading branch information
ycagel authored Feb 2, 2025
2 parents 074fd08 + f1ac1db commit 664c6a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
run: make check

- name: Upload Test Suite Log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-suite-log
Expand Down
17 changes: 12 additions & 5 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,18 @@ void LegacyScriptPubKeyMan::MarkUnusedAddresses(const CScript& script)
if (it != mapKeyMetadata.end()){
CKeyMetadata meta = it->second;
if (!meta.hd_seed_id.IsNull() && meta.hd_seed_id != m_hd_chain.seed_id) {
bool internal = (meta.key_origin.path[1] & ~BIP32_HARDENED_KEY_LIMIT) != 0;
int64_t index = meta.key_origin.path[2] & ~BIP32_HARDENED_KEY_LIMIT;

if (!TopUpInactiveHDChain(meta.hd_seed_id, index, internal)) {
WalletLogPrintf("%s: Adding inactive seed keys failed\n", __func__);
if (meta.key_origin.path.size() < 3) {
WalletLogPrintf("%s: Adding inactive seed keys failed, insufficient path size: %d, has_key_origin: %s\n",
__func__,
meta.key_origin.path.size(),
meta.has_key_origin);
} else {
bool internal = (meta.key_origin.path[1] & ~BIP32_HARDENED_KEY_LIMIT) != 0;
int64_t index = meta.key_origin.path[2] & ~BIP32_HARDENED_KEY_LIMIT;

if (!TopUpInactiveHDChain(meta.hd_seed_id, index, internal)) {
WalletLogPrintf("%s: Adding inactive seed keys failed\n", __func__);
}
}
}
}
Expand Down

0 comments on commit 664c6a3

Please sign in to comment.