Skip to content

Commit 664c6a3

Browse files
authored
Merge pull request #282 from JaredTate/develop
Fix 8.22.0 HD Wallet Import Crash Bug
2 parents 074fd08 + f1ac1db commit 664c6a3

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
run: make check
6464

6565
- name: Upload Test Suite Log
66-
uses: actions/upload-artifact@v3
66+
uses: actions/upload-artifact@v4
6767
if: failure()
6868
with:
6969
name: test-suite-log

src/wallet/scriptpubkeyman.cpp

+12-5
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,18 @@ void LegacyScriptPubKeyMan::MarkUnusedAddresses(const CScript& script)
375375
if (it != mapKeyMetadata.end()){
376376
CKeyMetadata meta = it->second;
377377
if (!meta.hd_seed_id.IsNull() && meta.hd_seed_id != m_hd_chain.seed_id) {
378-
bool internal = (meta.key_origin.path[1] & ~BIP32_HARDENED_KEY_LIMIT) != 0;
379-
int64_t index = meta.key_origin.path[2] & ~BIP32_HARDENED_KEY_LIMIT;
380-
381-
if (!TopUpInactiveHDChain(meta.hd_seed_id, index, internal)) {
382-
WalletLogPrintf("%s: Adding inactive seed keys failed\n", __func__);
378+
if (meta.key_origin.path.size() < 3) {
379+
WalletLogPrintf("%s: Adding inactive seed keys failed, insufficient path size: %d, has_key_origin: %s\n",
380+
__func__,
381+
meta.key_origin.path.size(),
382+
meta.has_key_origin);
383+
} else {
384+
bool internal = (meta.key_origin.path[1] & ~BIP32_HARDENED_KEY_LIMIT) != 0;
385+
int64_t index = meta.key_origin.path[2] & ~BIP32_HARDENED_KEY_LIMIT;
386+
387+
if (!TopUpInactiveHDChain(meta.hd_seed_id, index, internal)) {
388+
WalletLogPrintf("%s: Adding inactive seed keys failed\n", __func__);
389+
}
383390
}
384391
}
385392
}

0 commit comments

Comments
 (0)