Better error checking in consolidation for when CommitTransaction() fails
This commit is contained in:
@@ -209,10 +209,14 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pwalletMain->CommitConsolidationTx(tx);
|
if(pwalletMain->CommitConsolidationTx(tx)) {
|
||||||
LogPrint("zrpcunsafe", "%s: Committed consolidation transaction with txid=%s\n", getId(), tx.GetHash().ToString());
|
LogPrint("zrpcunsafe", "%s: Committed consolidation transaction with txid=%s\n", getId(), tx.GetHash().ToString());
|
||||||
amountConsolidated += amountToSend - fConsolidationTxFee;
|
amountConsolidated += amountToSend - fConsolidationTxFee;
|
||||||
consolidationTxIds.push_back(tx.GetHash().ToString());
|
consolidationTxIds.push_back(tx.GetHash().ToString());
|
||||||
|
} else {
|
||||||
|
LogPrint("zrpcunsafe", "%s: Consolidation transaction FAILED in CommitTransaction, txid=%s\n", getId(), tx.GetHash().ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
CWalletTx wtx(this, tx);
|
||||||
CReserveKey reservekey(pwalletMain);
|
CReserveKey reservekey(pwalletMain);
|
||||||
CommitTransaction(wtx, reservekey);
|
return CommitTransaction(wtx, reservekey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallet::SetBestChain(const CBlockLocator& loc)
|
void CWallet::SetBestChain(const CBlockLocator& loc)
|
||||||
|
|||||||
@@ -1258,7 +1258,7 @@ public:
|
|||||||
const CBlock *pblock,
|
const CBlock *pblock,
|
||||||
boost::optional<std::pair<SproutMerkleTree, SaplingMerkleTree>> added);
|
boost::optional<std::pair<SproutMerkleTree, SaplingMerkleTree>> added);
|
||||||
void RunSaplingConsolidation(int blockHeight);
|
void RunSaplingConsolidation(int blockHeight);
|
||||||
void CommitConsolidationTx(const CTransaction& tx);
|
bool CommitConsolidationTx(const CTransaction& tx);
|
||||||
/** Saves witness caches and best block locator to disk. */
|
/** Saves witness caches and best block locator to disk. */
|
||||||
void SetBestChain(const CBlockLocator& loc);
|
void SetBestChain(const CBlockLocator& loc);
|
||||||
std::set<std::pair<libzcash::PaymentAddress, uint256>> GetNullifiersForAddresses(const std::set<libzcash::PaymentAddress> & addresses);
|
std::set<std::pair<libzcash::PaymentAddress, uint256>> GetNullifiersForAddresses(const std::set<libzcash::PaymentAddress> & addresses);
|
||||||
|
|||||||
Reference in New Issue
Block a user