mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-10 22:13:47 +00:00
feat(consensus): update ValidateAnchorTx (#289)
* feat(consensus): update `ValidateAnchorTx` * feat(consensus): update `ValidateAnchorTx`
This commit is contained in:
parent
a748b914ab
commit
8ff161fb39
1 changed files with 3 additions and 2 deletions
|
|
@ -30,6 +30,7 @@ var (
|
||||||
GoldenTouchAccount = common.HexToAddress("0x0000777735367b36bC9B61C50022d9D0700dB4Ec")
|
GoldenTouchAccount = common.HexToAddress("0x0000777735367b36bC9B61C50022d9D0700dB4Ec")
|
||||||
TaikoL2AddressSuffix = "10001"
|
TaikoL2AddressSuffix = "10001"
|
||||||
AnchorSelector = crypto.Keccak256([]byte("anchor(bytes32,bytes32,uint64,uint32)"))[:4]
|
AnchorSelector = crypto.Keccak256([]byte("anchor(bytes32,bytes32,uint64,uint32)"))[:4]
|
||||||
|
AnchorV2Selector = crypto.Keccak256([]byte("anchorV2(uint64,bytes32,uint32,uint32,uint8)"))[:4]
|
||||||
AnchorGasLimit = uint64(250_000)
|
AnchorGasLimit = uint64(250_000)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -274,7 +275,7 @@ func (t *Taiko) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, p
|
||||||
return common.Big0
|
return common.Big0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateAnchorTx checks if the given transaction is a valid TaikoL2.anchor transaction.
|
// ValidateAnchorTx checks if the given transaction is a valid TaikoL2.anchor or TaikoL2.anchorV2 transaction.
|
||||||
func (t *Taiko) ValidateAnchorTx(tx *types.Transaction, header *types.Header) (bool, error) {
|
func (t *Taiko) ValidateAnchorTx(tx *types.Transaction, header *types.Header) (bool, error) {
|
||||||
if tx.Type() != types.DynamicFeeTxType {
|
if tx.Type() != types.DynamicFeeTxType {
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|
@ -284,7 +285,7 @@ func (t *Taiko) ValidateAnchorTx(tx *types.Transaction, header *types.Header) (b
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !bytes.HasPrefix(tx.Data(), AnchorSelector) {
|
if !bytes.HasPrefix(tx.Data(), AnchorSelector) && !bytes.HasPrefix(tx.Data(), AnchorV2Selector) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue