diff --git a/core/types/transaction.go b/core/types/transaction.go index 6257580733..5de6cb9ed7 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -52,23 +52,20 @@ const ( SetCodeTxType = 0x04 ) -type TxTypeBitVec [(SetCodeTxType + 1 + 7) / 8]byte +type txTypeBitVec [2]uint64 -func (v *TxTypeBitVec) Set(txType byte) { - if txType >= byte(len(v)*8) { - panic("tx type out of range") - } - v[txType/8] |= 1 << (txType % 8) +func (v *txTypeBitVec) Set(txType byte) { + v[txType/64] |= 1 << (txType % 64) } -func (v *TxTypeBitVec) Has(txType byte) bool { - if txType >= byte(len(v)*8) { +func (v *txTypeBitVec) Has(txType byte) bool { + if txType >= byte(len(v)*64) { 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 } diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 6c56c588d8..946719b8f2 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -182,7 +182,7 @@ type Signer interface { // 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). type modernSigner struct { - txTypeBitVec TxTypeBitVec + txTypeBitVec txTypeBitVec chainID *big.Int legacy Signer }