wallet: Avoid updating `ReserveDestination::nIndex` when `GetReservedDestination` fails

Github-Pull: bitcoin/bitcoin#29510
Rebased-From: 367bb7a80c
This commit is contained in:
UdjinM6 2024-02-28 13:00:00 +03:00 committed by Ava Chow
parent 1ce5accc32
commit 7c08ccf19b
No known key found for this signature in database
GPG Key ID: 17565732E08E5E41
1 changed files with 3 additions and 1 deletions

View File

@ -2596,8 +2596,10 @@ util::Result<CTxDestination> ReserveDestination::GetReservedDestination(bool int
if (nIndex == -1) {
CKeyPool keypool;
auto op_address = m_spk_man->GetReservedDestination(type, internal, nIndex, keypool);
int64_t index;
auto op_address = m_spk_man->GetReservedDestination(type, internal, index, keypool);
if (!op_address) return op_address;
nIndex = index;
address = *op_address;
fInternal = keypool.fInternal;
}