Avoid coredump if witness index does not exist
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user