diff --git a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp index e85ce5861..da0d4b94c 100644 --- a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp +++ b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp @@ -209,10 +209,14 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() { break; } - pwalletMain->CommitConsolidationTx(tx); - LogPrint("zrpcunsafe", "%s: Committed consolidation transaction with txid=%s\n", getId(), tx.GetHash().ToString()); - amountConsolidated += amountToSend - fConsolidationTxFee; - consolidationTxIds.push_back(tx.GetHash().ToString()); + if(pwalletMain->CommitConsolidationTx(tx)) { + LogPrint("zrpcunsafe", "%s: Committed consolidation transaction with txid=%s\n", getId(), tx.GetHash().ToString()); + amountConsolidated += amountToSend - fConsolidationTxFee; + consolidationTxIds.push_back(tx.GetHash().ToString()); + } else { + LogPrint("zrpcunsafe", "%s: Consolidation transaction FAILED in CommitTransaction, txid=%s\n", getId(), tx.GetHash().ToString()); + return false; + } } } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f8127e83d..df40a53ff 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -637,10 +637,10 @@ void CWallet::RunSaplingConsolidation(int blockHeight) { } } -void CWallet::CommitConsolidationTx(const CTransaction& tx) { +bool CWallet::CommitConsolidationTx(const CTransaction& tx) { CWalletTx wtx(this, tx); CReserveKey reservekey(pwalletMain); - CommitTransaction(wtx, reservekey); + return CommitTransaction(wtx, reservekey); } void CWallet::SetBestChain(const CBlockLocator& loc) diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index d9dc9e0a1..3dd658acb 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1258,7 +1258,7 @@ public: const CBlock *pblock, boost::optional> added); void RunSaplingConsolidation(int blockHeight); - void CommitConsolidationTx(const CTransaction& tx); + bool CommitConsolidationTx(const CTransaction& tx); /** Saves witness caches and best block locator to disk. */ void SetBestChain(const CBlockLocator& loc); std::set> GetNullifiersForAddresses(const std::set & addresses);