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())); }