From d6999c078cadd1d8d337e9cc9db98f6c2f907f39 Mon Sep 17 00:00:00 2001 From: Bushstar Date: Tue, 5 Nov 2024 09:30:37 +0000 Subject: [PATCH] Add TXID to swap results --- src/dfi/consensus/icxorders.cpp | 4 ++-- src/dfi/mn_checks.cpp | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/dfi/consensus/icxorders.cpp b/src/dfi/consensus/icxorders.cpp index f50be7b5ed..520cba0787 100644 --- a/src/dfi/consensus/icxorders.cpp +++ b/src/dfi/consensus/icxorders.cpp @@ -51,7 +51,7 @@ CAmount CICXOrdersConsensus::CalculateTakerFee(const CAmount amount, result.pushKV("calc_taker_fee_in_btc", GetDecimalString(((arith_uint256(amount) * mnview.ICXGetTakerFeePerBTC() / COIN).GetLow64()))); result.pushKV("calc_taker_fee_in_dfi", GetDecimalString(takerFee)); - LogPrint(BCLog::ICXBUG, "%s\n", result.write(0)); + LogPrint(BCLog::ICXBUG, "ICXCalc: %s\n", result.write(0)); } return takerFee; } @@ -593,7 +593,7 @@ Res CICXOrdersConsensus::operator()(const CICXClaimDFCHTLCMessage &obj) const { result.pushKV("claim_tx", tx.GetHash().ToString()); result.pushKV("address", EncodeDestination(dest)); result.pushKV("amount", GetDecimalString(offer->takerFee * 50 / 100)); - LogPrint(BCLog::ICXBUG, "%s\n", result.write(0)); + LogPrint(BCLog::ICXBUG, "ICX: %s\n", result.write(0)); } } } else { diff --git a/src/dfi/mn_checks.cpp b/src/dfi/mn_checks.cpp index ac7ec0431a..653d477a2c 100644 --- a/src/dfi/mn_checks.cpp +++ b/src/dfi/mn_checks.cpp @@ -1110,11 +1110,14 @@ Res CPoolSwap::ExecuteSwap(CCustomCSView &view, } if (LogAcceptCategory(BCLog::SWAPRESULT) && lastSwap) { - LogPrint(BCLog::SWAPRESULT, - "SwapResult: height=%d destination=%s result=%s\n", - height, - ScriptToString(obj.to), - swapAmountResult.ToString()); + UniValue result(UniValue::VOBJ); + result.pushKV("height", (int64_t)height); + if (txInfo) { + result.pushKV("txid", txInfo->second.ToString()); + } + result.pushKV("destination", ScriptToString(obj.to)); + result.pushKV("result", swapAmountResult.ToString()); + LogPrint(BCLog::SWAPRESULT, "SwapResult: %s\n", result.write(0)); } intermediateView.Flush();