Skip to content

Commit

Permalink
Add logging for consolidation addrs (#3120)
Browse files Browse the repository at this point in the history
* Add logging for consolidation addrs

* Add flag

* fix lints

* Revert "fix lints"

This reverts commit 9a87545.

* fix lints

* fmt

* cleanup

* Revert "cleanup"

This reverts commit 4fee794.
  • Loading branch information
prasannavl authored Nov 13, 2024
1 parent c17ae6d commit e58bdbc
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 37 deletions.
9 changes: 9 additions & 0 deletions src/dfi/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <validation.h>

#include <consensus/params.h>
#include <logging.h>
#include <boost/asio.hpp>

#define MILLI 0.001
Expand Down Expand Up @@ -1573,6 +1574,14 @@ void ConsolidateRewards(CCustomCSView &view,

LogPrintf("%s: address count: %d concurrency: %d\n", __func__, owners.size(), nWorkers);

if (LogAcceptCategory(BCLog::ACCOUNTCONSOLIDATE)) {
UniValue logAddrJsonArr(UniValue::VARR);
for (auto &owner : owners) {
logAddrJsonArr.push_back(ScriptToString(owner));
}
LogPrintf("%s: addrs: %s\n", __func__, logAddrJsonArr.write(2));
}

for (auto &owner : owners) {
// See https://github.com/DeFiCh/ain/pull/1291
// https://github.com/DeFiCh/ain/pull/1291#issuecomment-1137638060
Expand Down
1 change: 1 addition & 0 deletions src/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ const CLogCategoryDesc LogCategories[] =
{BCLog::CONNECT, "connect"},
{BCLog::OCEAN, "ocean"},
{BCLog::ICXBUG, "icxbug"},
{BCLog::ACCOUNTCONSOLIDATE, "accountconsolidate"},
{BCLog::ALL, "1"},
{BCLog::ALL, "all"},
};
Expand Down
75 changes: 38 additions & 37 deletions src/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,43 +43,44 @@ struct CLogCategoryActive

namespace BCLog {
enum LogFlags : uint64_t {
NONE = 0ull,
NET = (1ull << 0ull),
TOR = (1ull << 1ull),
MEMPOOL = (1ull << 2ull),
HTTP = (1ull << 3ull),
BENCH = (1ull << 4ull),
ZMQ = (1ull << 5ull),
DB = (1ull << 6ull),
RPC = (1ull << 7ull),
ESTIMATEFEE = (1ull << 8ull),
ADDRMAN = (1ull << 9ull),
SELECTCOINS = (1ull << 10ull),
REINDEX = (1ull << 11ull),
CMPCTBLOCK = (1ull << 12ull),
RAND = (1ull << 13ull),
PRUNE = (1ull << 14ull),
PROXY = (1ull << 15ull),
MEMPOOLREJ = (1ull << 16ull),
LIBEVENT = (1ull << 17ull),
COINDB = (1ull << 18ull),
LEVELDB = (1ull << 20ull),
STAKING = (1ull << 21ull),
ANCHORING = (1ull << 22ull),
SPV = (1ull << 23ull),
ORACLE = (1ull << 24ull),
LOAN = (1ull << 25ull),
ACCOUNTCHANGE = (1ull << 26ull),
FUTURESWAP = (1ull << 27ull),
TOKENSPLIT = (1ull << 28ull),
RPCCACHE = (1ull << 29ull),
CUSTOMTXBENCH = (1ull << 30ull),
CONNECT = (1ull << 31ull),
SIGN = (1ull << 32ull),
SWAPRESULT = (1ull << 33ull),
OCEAN = (1ull << 34ull),
ICXBUG = (1ull << 35ull),
ALL = ~(0ull),
NONE = 0ull,
NET = (1ull << 0ull),
TOR = (1ull << 1ull),
MEMPOOL = (1ull << 2ull),
HTTP = (1ull << 3ull),
BENCH = (1ull << 4ull),
ZMQ = (1ull << 5ull),
DB = (1ull << 6ull),
RPC = (1ull << 7ull),
ESTIMATEFEE = (1ull << 8ull),
ADDRMAN = (1ull << 9ull),
SELECTCOINS = (1ull << 10ull),
REINDEX = (1ull << 11ull),
CMPCTBLOCK = (1ull << 12ull),
RAND = (1ull << 13ull),
PRUNE = (1ull << 14ull),
PROXY = (1ull << 15ull),
MEMPOOLREJ = (1ull << 16ull),
LIBEVENT = (1ull << 17ull),
COINDB = (1ull << 18ull),
LEVELDB = (1ull << 20ull),
STAKING = (1ull << 21ull),
ANCHORING = (1ull << 22ull),
SPV = (1ull << 23ull),
ORACLE = (1ull << 24ull),
LOAN = (1ull << 25ull),
ACCOUNTCHANGE = (1ull << 26ull),
FUTURESWAP = (1ull << 27ull),
TOKENSPLIT = (1ull << 28ull),
RPCCACHE = (1ull << 29ull),
CUSTOMTXBENCH = (1ull << 30ull),
CONNECT = (1ull << 31ull),
SIGN = (1ull << 32ull),
SWAPRESULT = (1ull << 33ull),
OCEAN = (1ull << 34ull),
ICXBUG = (1ull << 35ull),
ACCOUNTCONSOLIDATE = (1ull << 36ull),
ALL = ~(0ull),
};

class Logger
Expand Down

0 comments on commit e58bdbc

Please sign in to comment.