check with bor (#612)

* check with bor

* lol
This commit is contained in:
Enrique Jose Avila Asapche 2022-08-30 14:50:34 +03:00 committed by GitHub
parent 1a42afe5f2
commit 393fcf6856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,6 +51,7 @@ type TxParseContext struct {
Sighash [32]byte
Sig [65]byte
withSender bool
withBor bool
chainIDRequired bool
IsProtected bool
validateRlp func([]byte) error
@ -64,6 +65,7 @@ func NewTxParseContext(chainID uint256.Int) *TxParseContext {
}
ctx := &TxParseContext{
withSender: true,
withBor: false,
Keccak1: sha3.NewLegacyKeccak256(),
Keccak2: sha3.NewLegacyKeccak256(),
}
@ -118,6 +120,7 @@ var ErrRlpTooBig = errors.New("txn rlp too big")
func (ctx *TxParseContext) ValidateRLP(f func(txnRlp []byte) error) { ctx.validateRlp = f }
func (ctx *TxParseContext) WithSender(v bool) { ctx.withSender = v }
func (ctx *TxParseContext) WithBor(v bool) { ctx.withBor = v }
func (ctx *TxParseContext) ChainIDRequired() *TxParseContext {
ctx.chainIDRequired = true
return ctx
@ -263,7 +266,7 @@ func (ctx *TxParseContext) ParseTransaction(payload []byte, pos int, slot *TxSlo
slot.DataLen = dataLen
isDataEmpty := dataLen == 0
if isEmptyHash && isDataEmpty && legacy {
if ctx.withBor && isEmptyHash && isDataEmpty && legacy {
slot.IsBor = true
}