forked from cerc-io/plugeth
internal/ethapi: bugfix gas price and limit swapped in eth_resend
This commit is contained in:
parent
a7cc3248fe
commit
6c959207db
@ -1170,8 +1170,7 @@ func (s *PublicTransactionPoolAPI) PendingTransactions() []*RPCTransaction {
|
|||||||
|
|
||||||
// Resend accepts an existing transaction and a new gas price and limit. It will remove the given transaction from the
|
// Resend accepts an existing transaction and a new gas price and limit. It will remove the given transaction from the
|
||||||
// pool and reinsert it with the new gas price and limit.
|
// pool and reinsert it with the new gas price and limit.
|
||||||
func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, tx *Tx, gasPrice, gasLimit *rpc.HexNumber) (common.Hash, error) {
|
func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, tx Tx, gasPrice, gasLimit *rpc.HexNumber) (common.Hash, error) {
|
||||||
|
|
||||||
pending := s.b.GetPoolTransactions()
|
pending := s.b.GetPoolTransactions()
|
||||||
for _, p := range pending {
|
for _, p := range pending {
|
||||||
if pFrom, err := p.FromFrontier(); err == nil && pFrom == tx.From && p.SigHash() == tx.tx.SigHash() {
|
if pFrom, err := p.FromFrontier(); err == nil && pFrom == tx.From && p.SigHash() == tx.tx.SigHash() {
|
||||||
@ -1184,9 +1183,9 @@ func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, tx *Tx, gasPrice,
|
|||||||
|
|
||||||
var newTx *types.Transaction
|
var newTx *types.Transaction
|
||||||
if tx.tx.To() == nil {
|
if tx.tx.To() == nil {
|
||||||
newTx = types.NewContractCreation(tx.tx.Nonce(), tx.tx.Value(), gasPrice.BigInt(), gasLimit.BigInt(), tx.tx.Data())
|
newTx = types.NewContractCreation(tx.tx.Nonce(), tx.tx.Value(), gasLimit.BigInt(), gasPrice.BigInt(), tx.tx.Data())
|
||||||
} else {
|
} else {
|
||||||
newTx = types.NewTransaction(tx.tx.Nonce(), *tx.tx.To(), tx.tx.Value(), gasPrice.BigInt(), gasLimit.BigInt(), tx.tx.Data())
|
newTx = types.NewTransaction(tx.tx.Nonce(), *tx.tx.To(), tx.tx.Value(), gasLimit.BigInt(), gasPrice.BigInt(), tx.tx.Data())
|
||||||
}
|
}
|
||||||
|
|
||||||
signedTx, err := s.sign(tx.From, newTx)
|
signedTx, err := s.sign(tx.From, newTx)
|
||||||
|
Loading…
Reference in New Issue
Block a user