From 702c2163cd13137e71778beca613ab4b7f792dda Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 30 Aug 2022 21:05:09 -0400 Subject: [PATCH 1/5] Log if we have no zsweepaddress or an invalid zsweepaddress --- src/wallet/asyncrpcoperation_sweep.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/asyncrpcoperation_sweep.cpp b/src/wallet/asyncrpcoperation_sweep.cpp index 60132bb38..b76915e92 100644 --- a/src/wallet/asyncrpcoperation_sweep.cpp +++ b/src/wallet/asyncrpcoperation_sweep.cpp @@ -103,12 +103,14 @@ bool AsyncRPCOperation_sweep::main_impl() { } } } else { + LogPrintf("%s: No zsweepaddress configured, exiting\n", opid); return false; } } else { if (boost::get(&rpcSweepAddress) != nullptr) { sweepAddress = boost::get(rpcSweepAddress); } else { + LogPrintf("%s: Invalid zsweepaddress, exiting\n", opid); return false; } } From b4b6988eb03cfc90332fbc82dec4e7e5d64b48be Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 30 Aug 2022 21:05:27 -0400 Subject: [PATCH 2/5] Log when we use fee=0 for small inputs --- src/wallet/asyncrpcoperation_sweep.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wallet/asyncrpcoperation_sweep.cpp b/src/wallet/asyncrpcoperation_sweep.cpp index b76915e92..721309385 100644 --- a/src/wallet/asyncrpcoperation_sweep.cpp +++ b/src/wallet/asyncrpcoperation_sweep.cpp @@ -197,9 +197,10 @@ bool AsyncRPCOperation_sweep::main_impl() { CAmount fee = fSweepTxFee; if (amountToSend <= fSweepTxFee) { - fee = 0; + LogPrintf("%s: Amount to send %s is <= fee, using fee=0", getId(), FormatMoney(amountToSend)); + fee = 0; } - amountSwept += amountToSend; + auto builder = TransactionBuilder(consensusParams, targetHeight_, pwalletMain); { LOCK2(cs_main, pwalletMain->cs_wallet); From b50c51f797c3b146ffb4bc81fa668e97e9d619cb Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 30 Aug 2022 21:05:57 -0400 Subject: [PATCH 3/5] Log value of status and correctly return status value instead of always returning success, derp --- src/wallet/asyncrpcoperation_sweep.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wallet/asyncrpcoperation_sweep.cpp b/src/wallet/asyncrpcoperation_sweep.cpp index 721309385..780ddfa29 100644 --- a/src/wallet/asyncrpcoperation_sweep.cpp +++ b/src/wallet/asyncrpcoperation_sweep.cpp @@ -293,10 +293,9 @@ bool AsyncRPCOperation_sweep::main_impl() { pwalletMain->fSweepRunning = false; } - LogPrintf("%s: Created %d transactions with total output amount=%s\n", getId(), numTxCreated, FormatMoney(amountSwept)); + LogPrintf("%s: Created %d transactions with total output amount=%s, status=%d\n", getId(), numTxCreated, FormatMoney(amountSwept), (int)status); setSweepResult(numTxCreated, amountSwept, sweepTxIds); - return true; - + return status; } void AsyncRPCOperation_sweep::setSweepResult(int numTxCreated, const CAmount& amountSwept, const std::vector& sweepTxIds) { From 57baf25b0257c30636484b6ac8e8191b2f2ab320 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 30 Aug 2022 22:05:41 -0400 Subject: [PATCH 4/5] Do not add to amountConsolidated until we successfully create the tx and only do it once --- src/wallet/asyncrpcoperation_saplingconsolidation.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp index 25c1f54ac..f9f2ebe1e 100644 --- a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp +++ b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp @@ -157,7 +157,6 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() { if (fromNotes.size() < minQuantity) continue; - amountConsolidated += amountToSend; auto builder = TransactionBuilder(consensusParams, targetHeight_, pwalletMain); builder.SetExpiryHeight(targetHeight_ + CONSOLIDATION_EXPIRY_DELTA); auto actualAmountToSend = amountToSend < fConsolidationTxFee ? 0 : amountToSend - fConsolidationTxFee; @@ -219,8 +218,6 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() { } } LogPrint("zrpcunsafe", "%s: Done adding %d sietch zouts\n", opid, MIN_ZOUTS); - //CTransaction tx = builder.Build(); - auto maybe_tx = builder.Build(); if (!maybe_tx) { LogPrintf("%s: Failed to build transaction.\n",opid); From 88263995c81c5c62f367bf3c2bb3bf7eb8ce2d7f Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 30 Aug 2022 22:27:34 -0400 Subject: [PATCH 5/5] Do not coredump if pnode=NULL in RelayTransaction --- src/net.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/net.cpp b/src/net.cpp index db47d5ec7..7df4f5e90 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2125,6 +2125,10 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss) // Only relay to randomly chosen 50% of peers BOOST_FOREACH(CNode* pnode, vRelayNodes) { + //TODO: correct fix is to correctly LOCK vRelayNodes + if(!pnode) + continue; + if(!pnode->fRelayTxes) continue; LOCK(pnode->cs_filter);