Skip to content

Commit

Permalink
Log ICX Bug (#3089)
Browse files Browse the repository at this point in the history
* Log ICX Bug

* One line output

* Add ICXBUG logging category

* Restore regtest check
  • Loading branch information
Bushstar authored Oct 10, 2024
1 parent 642cdb4 commit 97497e2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/dfi/consensus/icxorders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,20 @@ Res CICXOrdersConsensus::operator()(const CICXClaimDFCHTLCMessage &obj) const {
!res) {
return res;
}

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 97497e2

Please sign in to comment.