Skip to content

Commit 573f373

Browse files
karalabefjl
andauthored
internal/ethapi: print tx details when submitting (#22170)
This adds more info about submitted transactions in log messages. Co-authored-by: Felix Lange <[email protected]>
1 parent 7202b41 commit 573f373

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

internal/ethapi/api.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -1558,16 +1558,18 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
15581558
if err := b.SendTx(ctx, tx); err != nil {
15591559
return common.Hash{}, err
15601560
}
1561+
// Print a log with full tx details for manual investigations and interventions
1562+
signer := types.MakeSigner(b.ChainConfig(), b.CurrentBlock().Number())
1563+
from, err := types.Sender(signer, tx)
1564+
if err != nil {
1565+
return common.Hash{}, err
1566+
}
1567+
15611568
if tx.To() == nil {
1562-
signer := types.MakeSigner(b.ChainConfig(), b.CurrentBlock().Number())
1563-
from, err := types.Sender(signer, tx)
1564-
if err != nil {
1565-
return common.Hash{}, err
1566-
}
15671569
addr := crypto.CreateAddress(from, tx.Nonce())
1568-
log.Info("Submitted contract creation", "fullhash", tx.Hash().Hex(), "contract", addr.Hex())
1570+
log.Info("Submitted contract creation", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "contract", addr.Hex(), "value", tx.Value())
15691571
} else {
1570-
log.Info("Submitted transaction", "fullhash", tx.Hash().Hex(), "recipient", tx.To())
1572+
log.Info("Submitted transaction", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "recipient", tx.To(), "value", tx.Value())
15711573
}
15721574
return tx.Hash(), nil
15731575
}

0 commit comments

Comments
 (0)