From 968890c5919cbcc739cd60647037f4c25ed4cdb4 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Tue, 10 Mar 2020 09:10:05 -0400 Subject: [PATCH] More error checking and use a CAmount instead of int, which hopefully fixes CommitTransaction() bug --- src/wallet/asyncrpcoperation_saplingconsolidation.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp index 3ffb048ae..f8d6b017a 100644 --- a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp +++ b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp @@ -181,6 +181,7 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() { // Add the actual consolidation tx builder.AddSaplingOutput(extsk.expsk.ovk, addr, amountToSend - fConsolidationTxFee); + LogPrint("zrpcunsafe", "%s: Added consolidation output", getId(), addr); // Add sietch zouts int MIN_ZOUTS = 7; @@ -191,8 +192,11 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() { auto zaddr = DecodePaymentAddress(zdust); if (IsValidPaymentAddress(zaddr)) { auto sietchZoutput = boost::get(zaddr); - int amount=0; + CAmount amount=0; builder.AddSaplingOutput(extsk.expsk.ovk, sietchZoutput, amount); + } else { + LogPrint("zrpcunsafe", "%s: Invalid payment address! Stopping.", getId(), zaddr); + break; } } //CTransaction tx = builder.Build();