forked from cerc-io/plugeth
internal/ethapi: fix recover sender of pending transaction (#23765)
* internal/ethapi: fix recover sender of pending transaction * internal/ethapi: check if current exists
This commit is contained in:
parent
b8dc1e2705
commit
433f0919cc
@ -1334,10 +1334,12 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
|
|||||||
// newRPCPendingTransaction returns a pending transaction that will serialize to the RPC representation
|
// newRPCPendingTransaction returns a pending transaction that will serialize to the RPC representation
|
||||||
func newRPCPendingTransaction(tx *types.Transaction, current *types.Header, config *params.ChainConfig) *RPCTransaction {
|
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 {
|
if current != nil {
|
||||||
baseFee = misc.CalcBaseFee(config, current)
|
baseFee = misc.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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// newRPCTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.
|
// newRPCTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.
|
||||||
|
Loading…
Reference in New Issue
Block a user