From e58bdbce16ed95fd20b7d6f5196cf4f663f9315c Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Wed, 13 Nov 2024 22:24:44 +0800 Subject: [PATCH] Add logging for consolidation addrs (#3120) * Add logging for consolidation addrs * Add flag * fix lints * Revert "fix lints" This reverts commit 9a87545ca13877317612109d1a72d21b101eb9e6. * fix lints * fmt * cleanup * Revert "cleanup" This reverts commit 4fee794ab67f4e75624f8fad857902523c68c05f. --- src/dfi/validation.cpp | 9 +++++ src/logging.cpp | 1 + src/logging.h | 75 +++++++++++++++++++++--------------------- 3 files changed, 48 insertions(+), 37 deletions(-) diff --git a/src/dfi/validation.cpp b/src/dfi/validation.cpp index a00266234b..eeb9d2c166 100644 --- a/src/dfi/validation.cpp +++ b/src/dfi/validation.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #define MILLI 0.001 @@ -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 diff --git a/src/logging.cpp b/src/logging.cpp index 7b1f63c1ae..d50906c9c3 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -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"}, }; diff --git a/src/logging.h b/src/logging.h index b8c41341de..78854f5197 100644 --- a/src/logging.h +++ b/src/logging.h @@ -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