mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
wallet: Properly set hd chain counters when loading
When build CHDChains out of CKeyMetadata, the chain counters are actually 1 based, not 0 based, so 1 must be added to each index.
This commit is contained in:
parent
961b9e4e40
commit
70134eb34f
@ -556,9 +556,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||||||
}
|
}
|
||||||
if (internal) {
|
if (internal) {
|
||||||
chain.nVersion = CHDChain::VERSION_HD_CHAIN_SPLIT;
|
chain.nVersion = CHDChain::VERSION_HD_CHAIN_SPLIT;
|
||||||
chain.nInternalChainCounter = std::max(chain.nInternalChainCounter, index);
|
chain.nInternalChainCounter = std::max(chain.nInternalChainCounter, index + 1);
|
||||||
} else {
|
} else {
|
||||||
chain.nExternalChainCounter = std::max(chain.nExternalChainCounter, index);
|
chain.nExternalChainCounter = std::max(chain.nExternalChainCounter, index + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strType == DBKeys::WATCHMETA) {
|
} else if (strType == DBKeys::WATCHMETA) {
|
||||||
|
Loading…
Reference in New Issue
Block a user