beacon/engine: add `InclusionList` type
This commit is contained in:
parent
fc12dbe40b
commit
6e69743192
|
@ -17,6 +17,7 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"slices"
|
||||
|
@ -350,6 +351,35 @@ type ExecutionPayloadBody struct {
|
|||
Withdrawals []*types.Withdrawal `json:"withdrawals"`
|
||||
}
|
||||
|
||||
// Max size of inclusion list in bytes.
|
||||
const MaxBytesPerInclusionList = uint64(8192)
|
||||
|
||||
// InclusionList is a list of transactions that should be included in a payload.
|
||||
type InclusionList [][]byte
|
||||
|
||||
func (inclusionList InclusionList) MarshalJSON() ([]byte, error) {
|
||||
inclusionListHex := make([]hexutil.Bytes, len(inclusionList))
|
||||
for i, tx := range inclusionList {
|
||||
inclusionListHex[i] = tx
|
||||
}
|
||||
|
||||
return json.Marshal(inclusionListHex)
|
||||
}
|
||||
|
||||
func (inclusionList *InclusionList) UnmarshalJSON(input []byte) error {
|
||||
var inclusionListHex []hexutil.Bytes
|
||||
if err := json.Unmarshal(input, &inclusionListHex); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*inclusionList = make([][]byte, len(inclusionListHex))
|
||||
for i, tx := range inclusionListHex {
|
||||
(*inclusionList)[i] = tx
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Client identifiers to support ClientVersionV1.
|
||||
const (
|
||||
ClientCode = "GE"
|
||||
|
|
Loading…
Reference in New Issue