core/types: reuse signtx (#29152)

* core/types: reuse signtx

* core/types: inline signtx
This commit is contained in:
Vie 2024-03-05 15:33:52 +08:00 committed by GitHub
parent 5d5b384efd
commit 9b3ceb2137
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 7 deletions

View File

@ -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.