add logs for discarding transactions in addPendingTransactions

feature/log_tx
“GheisMohammadi” 10 months ago
parent 9b6261f4a1
commit 4ea4ba5b54
No known key found for this signature in database
GPG Key ID: 15073AED3829FE90
  1. 21
      node/node.go

@ -267,22 +267,34 @@ func addPendingTransactions(registry *registry.Registry, newTxs types.Transactio
if tx.ShardID() != tx.ToShardID() { if tx.ShardID() != tx.ToShardID() {
if !acceptCx { if !acceptCx {
errs = append(errs, errors.WithMessage(errInvalidEpoch, "cross-shard tx not accepted yet")) errs = append(errs, errors.WithMessage(errInvalidEpoch, "cross-shard tx not accepted yet"))
utils.Logger().Debug().Err(errors.WithMessage(errInvalidEpoch, "cross-shard tx not accepted yet")).
Str("tx_hash", tx.Hash().Hex()).
Msg("[addPendingTransactions] tx is not added to pending pool")
continue continue
} }
if isBeforeHIP30 { if isBeforeHIP30 {
if tx.ToShardID() >= nxtShards { if tx.ToShardID() >= nxtShards {
errs = append(errs, errors.New("shards 2 and 3 are shutting down in the next epoch")) errs = append(errs, errors.New("shards 2 and 3 are shutting down in the next epoch"))
utils.Logger().Debug().Err(errors.WithMessage(errInvalidEpoch, "shards 2 and 3 are shutting down in the next epoch")).
Str("tx_hash", tx.Hash().Hex()).
Msg("[addPendingTransactions] tx is not added to pending pool")
continue continue
} }
} }
} }
if tx.IsEthCompatible() && !bc.Config().IsEthCompatible(bc.CurrentBlock().Epoch()) { if tx.IsEthCompatible() && !bc.Config().IsEthCompatible(bc.CurrentBlock().Epoch()) {
errs = append(errs, errors.WithMessage(errInvalidEpoch, "ethereum tx not accepted yet")) errs = append(errs, errors.WithMessage(errInvalidEpoch, "ethereum tx not accepted yet"))
utils.Logger().Debug().Err(errors.WithMessage(errInvalidEpoch, "ethereum tx not accepted yet")).
Str("tx_hash", tx.Hash().Hex()).
Msg("[addPendingTransactions] tx is not added to pending pool")
continue continue
} }
if isBeforeHIP30 { if isBeforeHIP30 {
if bc.ShardID() >= nxtShards { if bc.ShardID() >= nxtShards {
errs = append(errs, errors.New("shards 2 and 3 are shutting down in the next epoch")) errs = append(errs, errors.New("shards 2 and 3 are shutting down in the next epoch"))
utils.Logger().Debug().Err(errors.WithMessage(errInvalidEpoch, "shards 2 and 3 are shutting down in the next epoch")).
Str("tx_hash", tx.Hash().Hex()).
Msg("[addPendingTransactions] tx is not added to pending pool")
continue continue
} }
} }
@ -314,6 +326,13 @@ func (node *Node) addPendingStakingTransactions(newStakingTxs staking.StakingTra
poolTxs = append(poolTxs, tx) poolTxs = append(poolTxs, tx)
} }
errs := node.TxPool.AddRemotes(poolTxs) errs := node.TxPool.AddRemotes(poolTxs)
if len(errs) > 0 {
for _, err := range errs {
utils.Logger().Debug().
Err(err).
Msg("[addPendingStakingTransactions] AddRemotes failed")
}
}
pendingCount, queueCount := node.TxPool.Stats() pendingCount, queueCount := node.TxPool.Stats()
utils.Logger().Info(). utils.Logger().Info().
Int("length of newStakingTxs", len(poolTxs)). Int("length of newStakingTxs", len(poolTxs)).
@ -366,7 +385,7 @@ func (node *Node) AddPendingTransaction(newTx *types.Transaction) error {
var err error var err error
for i := range errs { for i := range errs {
if errs[i] != nil { if errs[i] != nil {
utils.Logger().Info().Err(errs[i]).Msg("[AddPendingTransaction] Failed adding new transaction") // utils.Logger().Info().Err(errs[i]).Msg("[AddPendingTransaction] Failed adding new transaction")
err = errs[i] err = errs[i]
break break
} }

Loading…
Cancel
Save