mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
parent
76aa15b7d0
commit
7fad428a8f
1 changed files with 1 additions and 7 deletions
|
|
@ -98,13 +98,7 @@ func SignTx(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, err
|
||||||
|
|
||||||
// SignNewTx creates a transaction and signs it.
|
// SignNewTx creates a transaction and signs it.
|
||||||
func SignNewTx(prv *ecdsa.PrivateKey, s Signer, txdata TxData) (*Transaction, error) {
|
func SignNewTx(prv *ecdsa.PrivateKey, s Signer, txdata TxData) (*Transaction, error) {
|
||||||
tx := NewTx(txdata)
|
return SignTx(NewTx(txdata), s, prv)
|
||||||
h := s.Hash(tx)
|
|
||||||
sig, err := crypto.Sign(h[:], prv)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return tx.WithSignature(s, sig)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MustSignNewTx creates a transaction and signs it.
|
// MustSignNewTx creates a transaction and signs it.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue