mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
Apply suggestions from code review
This commit is contained in:
parent
00c8108e71
commit
0c99260e4d
1 changed files with 4 additions and 2 deletions
|
|
@ -251,8 +251,8 @@ func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction
|
|||
// Extract the Ethereum signature and do a sanity validation
|
||||
if len(response.GetSignatureR()) == 0 || len(response.GetSignatureS()) == 0 {
|
||||
return common.Address{}, nil, errors.New("reply lacks signature")
|
||||
} else if response.GetSignatureV() == 0 && int(chainID.Int64()) < 2147483630 {
|
||||
// for chainId >= 2147483630, Trezor returns signature bit only
|
||||
} else if response.GetSignatureV() == 0 && int(chainID.Int64()) < uint32 {
|
||||
// for chainId >= (MaxUint32-36)/2, Trezor returns signature bit only
|
||||
// https://github.com/trezor/trezor-mcu/pull/399
|
||||
return common.Address{}, nil, errors.New("reply lacks signature")
|
||||
}
|
||||
|
|
@ -265,6 +265,8 @@ func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction
|
|||
} else {
|
||||
// Trezor backend does not support typed transactions yet.
|
||||
signer = types.NewEIP155Signer(chainID)
|
||||
// if chainId is above (MaxUint32 - 36) / 2 then the final v values is returned
|
||||
// directly. Otherwise, the returned value is 35 + chainid * 2.
|
||||
if signature[64] > 1 {
|
||||
signature[64] -= byte(chainID.Uint64()*2 + 35)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue