mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
This commit is contained in:
parent
51b99e40a8
commit
b6b1c4b779
1 changed files with 7 additions and 3 deletions
|
|
@ -1680,7 +1680,7 @@ type RPCTransaction struct {
|
||||||
// newRPCTransaction returns a transaction that will serialize to the RPC
|
// newRPCTransaction returns a transaction that will serialize to the RPC
|
||||||
// representation, with the given location metadata set (if available).
|
// 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 {
|
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)
|
from, _ := types.Sender(signer, tx)
|
||||||
v, r, s := tx.RawSignatureValues()
|
v, r, s := tx.RawSignatureValues()
|
||||||
result := &RPCTransaction{
|
result := &RPCTransaction{
|
||||||
|
|
@ -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
|
// 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 = eip1559.CalcBaseFee(config, current)
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 a new issue