mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-16 09:50:45 +00:00
core/types: use switch improve readability in function IsVotingTransaction (#1868)
This commit is contained in:
parent
4b7963e0ae
commit
b624614ebc
1 changed files with 5 additions and 3 deletions
|
|
@ -511,11 +511,13 @@ func (tx *Transaction) IsVotingTransaction() (bool, *common.Address) {
|
||||||
var end int
|
var end int
|
||||||
data := tx.Data()
|
data := tx.Data()
|
||||||
method := hexutil.Encode(data[0:4])
|
method := hexutil.Encode(data[0:4])
|
||||||
if method == common.VoteMethod || method == common.ProposeMethod || method == common.ResignMethod {
|
|
||||||
|
switch method {
|
||||||
|
case common.VoteMethod, common.ProposeMethod, common.ResignMethod:
|
||||||
end = len(data)
|
end = len(data)
|
||||||
} else if method == common.UnvoteMethod {
|
case common.UnvoteMethod:
|
||||||
end = len(data) - 32
|
end = len(data) - 32
|
||||||
} else {
|
default:
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue