From 9b3ceb2137df125dd0f6957a362e9f08d6c41b66 Mon Sep 17 00:00:00 2001 From: Vie Date: Tue, 5 Mar 2024 15:33:52 +0800 Subject: [PATCH] core/types: reuse signtx (#29152) * core/types: reuse signtx * core/types: inline signtx --- core/types/transaction_signing.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 9e26642f75..70dee0776e 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -107,13 +107,7 @@ func SignTx(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, err // SignNewTx creates a transaction and signs it. func SignNewTx(prv *ecdsa.PrivateKey, s Signer, txdata TxData) (*Transaction, error) { - tx := NewTx(txdata) - h := s.Hash(tx) - sig, err := crypto.Sign(h[:], prv) - if err != nil { - return nil, err - } - return tx.WithSignature(s, sig) + return SignTx(NewTx(txdata), s, prv) } // MustSignNewTx creates a transaction and signs it.