mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 13:44:31 +00:00
core/types: use switch improve readability (#1867)
This commit is contained in:
parent
07c6262d42
commit
4b7963e0ae
1 changed files with 13 additions and 8 deletions
|
|
@ -41,13 +41,6 @@ var (
|
|||
errInvalidYParity = errors.New("'yParity' field must be 0 or 1")
|
||||
errVYParityMismatch = errors.New("'v' and 'yParity' fields do not match")
|
||||
errVYParityMissing = errors.New("missing 'yParity' or 'v' field in transaction")
|
||||
|
||||
skipNonceDestinationAddress = map[common.Address]bool{
|
||||
common.XDCXAddrBinary: true,
|
||||
common.TradingStateAddrBinary: true,
|
||||
common.XDCXLendingAddressBinary: true,
|
||||
common.XDCXLendingFinalizedTradeAddressBinary: true,
|
||||
}
|
||||
)
|
||||
|
||||
// Transaction types.
|
||||
|
|
@ -482,7 +475,19 @@ func (tx *Transaction) IsLendingFinalizedTradeTransaction() bool {
|
|||
|
||||
func (tx *Transaction) IsSkipNonceTransaction() bool {
|
||||
to := tx.To()
|
||||
return to != nil && skipNonceDestinationAddress[*to]
|
||||
if to == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
switch *to {
|
||||
case common.XDCXAddrBinary,
|
||||
common.TradingStateAddrBinary,
|
||||
common.XDCXLendingAddressBinary,
|
||||
common.XDCXLendingFinalizedTradeAddressBinary:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (tx *Transaction) IsSigningTransaction() bool {
|
||||
|
|
|
|||
Loading…
Reference in a new issue