From 7c82b2758c6bcfb8a94d2086f0d40088286815e8 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 28 Feb 2024 13:00:00 +0300 Subject: [PATCH] wallet: Avoid updating `ReserveDestination::nIndex` when `GetReservedDestination` fails Github-Pull: #29510 Rebased-From: 367bb7a80cc71130995672c853d4a6e0134721d6 --- src/wallet/wallet.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 78febb8195f..31372cb3da6 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2561,8 +2561,10 @@ util::Result 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; }