From 34829af017dbbe744f02b33c4740433fbf58d47c Mon Sep 17 00:00:00 2001 From: Duke Date: Fri, 22 Aug 2025 07:34:11 -0400 Subject: [PATCH] Avoid coredump if witness index does not exist --- src/wallet/asyncrpcoperation_sendmany.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index 448a4bcf8..0c58cb25e 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -428,16 +428,14 @@ bool AsyncRPCOperation_sendmany::main_impl() { // Add Sapling spends for (size_t i = 0; i < saplingNoteInputs_.size(); i++) { - //LOCK2(cs_main, pwalletMain->cs_wallet); - - //TODO: avoid coredump here if this index does not exist - if (!witnesses[i]) { + if (!witnesses.at(i)) { throw JSONRPCError(RPC_WALLET_ERROR, strprintf( "Missing witness for Sapling note at outpoint %s", std::get<0>(saplingNoteInputs_[i]).ToString()) ); } if(fZdebug) LogPrintf("%s: Adding Sapling spend\n", __func__); + assert(builder_.AddSaplingSpend(expsk, std::get<1>(saplingNoteInputs_[i]), anchor, witnesses[i].get())); }