mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
refactor to use [2]uint64
This commit is contained in:
parent
3c6d115b06
commit
0c67e7cb71
2 changed files with 8 additions and 11 deletions
|
|
@ -52,23 +52,20 @@ const (
|
||||||
SetCodeTxType = 0x04
|
SetCodeTxType = 0x04
|
||||||
)
|
)
|
||||||
|
|
||||||
type TxTypeBitVec [(SetCodeTxType + 1 + 7) / 8]byte
|
type txTypeBitVec [2]uint64
|
||||||
|
|
||||||
func (v *TxTypeBitVec) Set(txType byte) {
|
func (v *txTypeBitVec) Set(txType byte) {
|
||||||
if txType >= byte(len(v)*8) {
|
v[txType/64] |= 1 << (txType % 64)
|
||||||
panic("tx type out of range")
|
|
||||||
}
|
|
||||||
v[txType/8] |= 1 << (txType % 8)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *TxTypeBitVec) Has(txType byte) bool {
|
func (v *txTypeBitVec) Has(txType byte) bool {
|
||||||
if txType >= byte(len(v)*8) {
|
if txType >= byte(len(v)*64) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return v[txType/8]&(1<<(txType%8)) != 0
|
return v[txType/64]&(1<<(txType%64)) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *TxTypeBitVec) Equals(o *TxTypeBitVec) bool {
|
func (v *txTypeBitVec) Equals(o *txTypeBitVec) bool {
|
||||||
return *v == *o
|
return *v == *o
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ type Signer interface {
|
||||||
// modernSigner is the signer implementation that handles non-legacy transaction types.
|
// modernSigner is the signer implementation that handles non-legacy transaction types.
|
||||||
// For legacy transactions, it defers to one of the legacy signers (frontier, homestead, eip155).
|
// For legacy transactions, it defers to one of the legacy signers (frontier, homestead, eip155).
|
||||||
type modernSigner struct {
|
type modernSigner struct {
|
||||||
txTypeBitVec TxTypeBitVec
|
txTypeBitVec txTypeBitVec
|
||||||
chainID *big.Int
|
chainID *big.Int
|
||||||
legacy Signer
|
legacy Signer
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue