Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@ type RPCTransaction struct {
// newRPCTransaction returns a transaction that will serialize to the RPC
// representation, with the given location metadata set (if available).
func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int, config *params.ChainConfig) *RPCTransaction {
signer := types.MakeSigner(config, big.NewInt(0).SetUint64(blockNumber))
signer := types.MakeSigner(config, new(big.Int).SetUint64(blockNumber))
from, _ := types.Sender(signer, tx)
v, r, s := tx.RawSignatureValues()
result := &RPCTransaction{
Expand Down Expand Up @@ -1765,11 +1765,15 @@ func effectiveGasPrice(tx *types.Transaction, baseFee *big.Int) *big.Int {

// newRPCPendingTransaction returns a pending transaction that will serialize to the RPC representation
func newRPCPendingTransaction(tx *types.Transaction, current *types.Header, config *params.ChainConfig) *RPCTransaction {
var baseFee *big.Int
var (
baseFee *big.Int
blockNumber = uint64(0)
)
if current != nil {
baseFee = eip1559.CalcBaseFee(config, current)
blockNumber = current.Number.Uint64()
}
return newRPCTransaction(tx, common.Hash{}, 0, 0, baseFee, config)
return newRPCTransaction(tx, common.Hash{}, blockNumber, 0, baseFee, config)
}
Comment on lines 1767 to 1777
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding test coverage for this bug fix to ensure that pending transactions correctly recover the sender address at different block heights, especially around fork boundaries (EIP-155, EIP-1559, Prague, etc.). This would help prevent regression of this issue in the future.

Copilot uses AI. Check for mistakes.

// newRPCTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.
Expand Down