Skip to content

Commit

Permalink
Add TXID to swap results (#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar authored Nov 5, 2024
1 parent 53535ce commit 1a2283b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/dfi/consensus/icxorders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand Down
13 changes: 8 additions & 5 deletions src/dfi/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1a2283b

Please sign in to comment.