WithSignature returns a new transaction with the given signature. This signature needs to be formatted as described in the yellow paper (v+27).
(signer Signer, sig []byte)
| 231 | // WithSignature returns a new transaction with the given signature. |
| 232 | // This signature needs to be formatted as described in the yellow paper (v+27). |
| 233 | func (tx *Transaction) WithSignature(signer Signer, sig []byte) (*Transaction, error) { |
| 234 | r, s, v, err := signer.SignatureValues(tx, sig) |
| 235 | if err != nil { |
| 236 | return nil, err |
| 237 | } |
| 238 | cpy := &Transaction{data: tx.data} |
| 239 | cpy.data.R, cpy.data.S, cpy.data.V = r, s, v |
| 240 | return cpy, nil |
| 241 | } |
| 242 | |
| 243 | // Cost returns amount + gasprice * gaslimit. |
| 244 | func (tx *Transaction) Cost() *big.Int { |