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
|
// Add Sapling spends
|
||||||
for (size_t i = 0; i < saplingNoteInputs_.size(); i++) {
|
for (size_t i = 0; i < saplingNoteInputs_.size(); i++) {
|
||||||
//LOCK2(cs_main, pwalletMain->cs_wallet);
|
if (!witnesses.at(i)) {
|
||||||
|
|
||||||
//TODO: avoid coredump here if this index does not exist
|
|
||||||
if (!witnesses[i]) {
|
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR,
|
throw JSONRPCError(RPC_WALLET_ERROR,
|
||||||
strprintf( "Missing witness for Sapling note at outpoint %s", std::get<0>(saplingNoteInputs_[i]).ToString())
|
strprintf( "Missing witness for Sapling note at outpoint %s", std::get<0>(saplingNoteInputs_[i]).ToString())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(fZdebug)
|
if(fZdebug)
|
||||||
LogPrintf("%s: Adding Sapling spend\n", __func__);
|
LogPrintf("%s: Adding Sapling spend\n", __func__);
|
||||||
|
|
||||||
assert(builder_.AddSaplingSpend(expsk, std::get<1>(saplingNoteInputs_[i]), anchor, witnesses[i].get()));
|
assert(builder_.AddSaplingSpend(expsk, std::get<1>(saplingNoteInputs_[i]), anchor, witnesses[i].get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user