From 9b6261f4a10e0c8bfe8df304f9fb02310985c7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CGheisMohammadi=E2=80=9D?= <36589218+GheisMohammadi@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:32:06 +0800 Subject: [PATCH] add more logs for transaction and pool --- node/node.go | 6 ++++++ node/node_newblock.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/node/node.go b/node/node.go index 67d04fc04..c0f47a469 100644 --- a/node/node.go +++ b/node/node.go @@ -286,6 +286,9 @@ func addPendingTransactions(registry *registry.Registry, newTxs types.Transactio continue } } + utils.Logger().Debug(). + Str("tx_hash", tx.Hash().Hex()). + Msg("[addPendingTransactions] tx is added to the txs pool array") poolTxs = append(poolTxs, tx) } errs = append(errs, registry.GetTxPool().AddRemotes(poolTxs)...) @@ -305,6 +308,9 @@ func (node *Node) addPendingStakingTransactions(newStakingTxs staking.StakingTra if node.Blockchain().Config().IsPreStaking(node.Blockchain().CurrentHeader().Epoch()) { poolTxs := types.PoolTransactions{} for _, tx := range newStakingTxs { + utils.Logger().Debug(). + Str("tx_hash", tx.Hash().Hex()). + Msg("[addPendingStakingTransactions] tx is added to the txs pool array") poolTxs = append(poolTxs, tx) } errs := node.TxPool.AddRemotes(poolTxs) diff --git a/node/node_newblock.go b/node/node_newblock.go index fdca8b741..675267295 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -175,14 +175,17 @@ func (node *Node) ProposeNewBlock(commitSigs chan []byte) (*types.Block, error) plainTxsPerAcc := types.Transactions{} for _, tx := range poolTxs { if plainTx, ok := tx.(*types.Transaction); ok { + utils.Logger().Info().Str("tx_hash", tx.Hash().Hex()).Msg("add transaction to proposing block") plainTxsPerAcc = append(plainTxsPerAcc, plainTx) } else if stakingTx, ok := tx.(*staking.StakingTransaction); ok { // Only process staking transactions after pre-staking epoch happened. if node.Blockchain().Config().IsPreStaking(node.Worker.GetCurrentHeader().Epoch()) { + utils.Logger().Info().Str("tx_hash", tx.Hash().Hex()).Msg("add staking transaction to proposing block") pendingStakingTxs = append(pendingStakingTxs, stakingTx) } } else { utils.Logger().Err(types.ErrUnknownPoolTxType). + Str("tx_hash", tx.Hash().Hex()). Msg("Failed to parse pending transactions") return nil, types.ErrUnknownPoolTxType }