Skip to content

Commit

Permalink
Add ICXBUG logging category
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Oct 10, 2024
1 parent 8098356 commit 85f02d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/dfi/consensus/icxorders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,16 +559,19 @@ Res CICXOrdersConsensus::operator()(const CICXClaimDFCHTLCMessage &obj) const {
return res;
}

CTxDestination dest;
ExtractDestination(order->ownerAddress, dest);
UniValue result(UniValue::VOBJ);
result.pushKV("order_tx", order->creationTx.ToString());
result.pushKV("offer_tx", dfchtlc->offerTx.ToString());
result.pushKV("dfchtlc_tx", dfchtlc->creationTx.ToString());
result.pushKV("claim_tx", tx.GetHash().ToString());
result.pushKV("address", EncodeDestination(dest));
result.pushKV("amount", GetDecimalString(offer->takerFee * 50 / 100));
LogPrintf("ICXBug %s\n", result.write(0));
if (LogAcceptCategory(BCLog::ICXBUG)) {
CTxDestination dest;
if (ExtractDestination(order->ownerAddress, dest)) {
UniValue result(UniValue::VOBJ);
result.pushKV("order_tx", order->creationTx.ToString());
result.pushKV("offer_tx", dfchtlc->offerTx.ToString());
result.pushKV("dfchtlc_tx", dfchtlc->creationTx.ToString());
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));
}
}
} else {
// Bug fixed
if (auto res = TransferTokenBalance(DCT_ID{0}, offer->takerFee * 50 / 100, CScript(), order->ownerAddress);
Expand Down
1 change: 1 addition & 0 deletions src/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const CLogCategoryDesc LogCategories[] =
{BCLog::SWAPRESULT, "swapresult"},
{BCLog::CONNECT, "connect"},
{BCLog::OCEAN, "ocean"},
{BCLog::ICXBUG, "icxbug"},
{BCLog::ALL, "1"},
{BCLog::ALL, "all"},
};
Expand Down
1 change: 1 addition & 0 deletions src/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace BCLog {
SIGN = (1ull << 32ull),
SWAPRESULT = (1ull << 33ull),
OCEAN = (1ull << 34ull),
ICXBUG = (1ull << 35ull),
ALL = ~(0ull),
};

Expand Down

0 comments on commit 85f02d6

Please sign in to comment.