mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
refactor
This commit is contained in:
parent
a5a75900e1
commit
be3ece28d9
1 changed files with 3 additions and 11 deletions
|
|
@ -343,19 +343,11 @@ func (s eip2930Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *bi
|
||||||
switch txdata := tx.inner.(type) {
|
switch txdata := tx.inner.(type) {
|
||||||
case *LegacyTx:
|
case *LegacyTx:
|
||||||
return s.EIP155Signer.SignatureValues(tx, sig)
|
return s.EIP155Signer.SignatureValues(tx, sig)
|
||||||
case *AccessListTx:
|
case *AccessListTx, *DelegateTx:
|
||||||
// Check that chain ID of tx matches the signer. We also accept ID zero here,
|
// Check that chain ID of tx matches the signer. We also accept ID zero here,
|
||||||
// because it indicates that the chain ID was not specified in the tx.
|
// because it indicates that the chain ID was not specified in the tx.
|
||||||
if txdata.ChainID.Sign() != 0 && txdata.ChainID.Cmp(s.chainId) != 0 {
|
if txdata.chainID().Sign() != 0 && txdata.chainID().Cmp(s.chainId) != 0 {
|
||||||
return nil, nil, nil, fmt.Errorf("%w: have %d want %d", ErrInvalidChainId, txdata.ChainID, s.chainId)
|
return nil, nil, nil, fmt.Errorf("%w: have %d want %d", ErrInvalidChainId, txdata.chainID(), s.chainId)
|
||||||
}
|
|
||||||
R, S, _ = decodeSignature(sig)
|
|
||||||
V = big.NewInt(int64(sig[64]))
|
|
||||||
case *DelegateTx:
|
|
||||||
// Check that chain ID of tx matches the signer. We also accept ID zero here,
|
|
||||||
// because it indicates that the chain ID was not specified in the tx.
|
|
||||||
if txdata.ChainID.Sign() != 0 && txdata.ChainID.Cmp(s.chainId) != 0 {
|
|
||||||
return nil, nil, nil, fmt.Errorf("%w: have %d want %d", ErrInvalidChainId, txdata.ChainID, s.chainId)
|
|
||||||
}
|
}
|
||||||
R, S, _ = decodeSignature(sig)
|
R, S, _ = decodeSignature(sig)
|
||||||
V = big.NewInt(int64(sig[64]))
|
V = big.NewInt(int64(sig[64]))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue