From 67e632bd604588162d44a25cd593f51bc9f24f70 Mon Sep 17 00:00:00 2001 From: Fuzzbawls Date: Sun, 28 Jul 2024 13:36:57 -0700 Subject: [PATCH] [Bug] Exit early for budget submission when the wallet is locked When the wallet is configured for budget submission, an issue arises where the keypool gets exhausted when the wallet is locked, causing a crash. This prevents such behavior. --- src/budget/budgetmanager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/budget/budgetmanager.cpp b/src/budget/budgetmanager.cpp index 491ca5839aa99..9b6d3bf6f84f3 100644 --- a/src/budget/budgetmanager.cpp +++ b/src/budget/budgetmanager.cpp @@ -165,6 +165,11 @@ uint256 CBudgetManager::SubmitFinalBudget() LogPrint(BCLog::MNBUDGET,"%s: Wallet not found\n", __func__); return UINT256_ZERO; } + // Exit if wallet is locked + if (vpwallets[0]->IsLocked()) { + LogPrint(BCLog::MNBUDGET, "%s: Wallet is locked, can't make collateral transaction.\n", __func__); + return UINT256_ZERO; + } CReserveKey keyChange(vpwallets[0]); if (!vpwallets[0]->CreateBudgetFeeTX(wtx, budgetHash, keyChange, BUDGET_FEE_TX)) { LogPrint(BCLog::MNBUDGET,"%s: Can't make collateral transaction\n", __func__);