diff --git a/node/node.go b/node/node.go index e4d567066..67d04fc04 100644 --- a/node/node.go +++ b/node/node.go @@ -221,12 +221,12 @@ func (node *Node) tryBroadcast(tx *types.Transaction) { msg := proto_node.ConstructTransactionListMessageAccount(types.Transactions{tx}) shardGroupID := nodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(tx.ShardID())) - utils.Logger().Info().Str("shardGroupID", string(shardGroupID)).Msg("tryBroadcast") + utils.Logger().Info().Str("tx_hash", tx.Hash().Hex()).Str("shardGroupID", string(shardGroupID)).Msg("tryBroadcast") for attempt := 0; attempt < NumTryBroadCast; attempt++ { err := node.host.SendMessageToGroups([]nodeconfig.GroupID{shardGroupID}, p2p.ConstructMessage(msg)) if err != nil { - utils.Logger().Error().Int("attempt", attempt).Msg("Error when trying to broadcast tx") + utils.Logger().Error().Str("tx_hash", tx.Hash().Hex()).Int("attempt", attempt).Msg("Error when trying to broadcast tx") } else { break } @@ -239,12 +239,12 @@ func (node *Node) tryBroadcastStaking(stakingTx *staking.StakingTransaction) { shardGroupID := nodeconfig.NewGroupIDByShardID( nodeconfig.ShardID(shard.BeaconChainShardID), ) // broadcast to beacon chain - utils.Logger().Info().Str("shardGroupID", string(shardGroupID)).Msg("tryBroadcastStaking") + utils.Logger().Info().Str("tx_hash", stakingTx.Hash().Hex()).Str("shardGroupID", string(shardGroupID)).Msg("tryBroadcastStaking") for attempt := 0; attempt < NumTryBroadCast; attempt++ { if err := node.host.SendMessageToGroups([]nodeconfig.GroupID{shardGroupID}, p2p.ConstructMessage(msg)); err != nil { - utils.Logger().Error().Int("attempt", attempt).Msg("Error when trying to broadcast staking tx") + utils.Logger().Error().Str("tx_hash", stakingTx.Hash().Hex()).Int("attempt", attempt).Msg("Error when trying to broadcast staking tx") } else { break } diff --git a/node/node_handler.go b/node/node_handler.go index 92c3396d4..698e868e7 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -115,6 +115,13 @@ func (node *Node) transactionMessageHandler(msgPayload []byte) { Msg("Failed to deserialize transaction list") return } + // log the transactions + for _, tx := range txs { + utils.Logger().Info(). + Str("tx_hash", tx.Hash().Hex()). + Msg("Received a new transaction, adding to pending transactions") + } + // add txs to pending list addPendingTransactions(node.registry, txs) } } @@ -132,6 +139,13 @@ func (node *Node) stakingMessageHandler(msgPayload []byte) { Msg("Failed to deserialize staking transaction list") return } + // log the transactions + for _, tx := range txs { + utils.Logger().Info(). + Str("tx_hash", tx.Hash().Hex()). + Msg("Received a new staking transaction, adding to pending staking transactions") + } + // add txs to pending list node.addPendingStakingTransactions(txs) } }