-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.go
53 lines (41 loc) · 1.06 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"errors"
"math/big"
"github.com/ethereum/go-ethereum/miner/collator"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
)
func PluginConstructor(cfg *map[string]interface{}, stack *node.Node) (collator.Collator, error) {
if cfg == nil {
return nil, errors.New("expected config")
}
config := *cfg
val, okay := config["maxMergedBundles"]
if !okay {
return nil, errors.New("no field maxMergedBundles in config")
}
mmb, okay := val.(int64)
if !okay {
return nil, errors.New("field maxMergedBundles must be an integer")
}
// TODO some sanity check to make sure maxMergedBundles is a reasonable value
maxMergedBundles := (uint)(mmb)
collator := MevCollator{
maxMergedBundles: maxMergedBundles,
bestProfit: big.NewInt(0),
}
api := rpc.API{
Service: MevCollatorAPI{&collator},
Version: "0.1",
Namespace: "eth",
Public: false,
}
stack.RegisterAPIs([]rpc.API{
api,
})
return &collator, nil
}
func main() {
// var asdf miner.CollatorPluginConstructorFunc = PluginConstructor
}