forked from ava-labs/coreth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (35 loc) · 981 Bytes
/
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
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package main
import (
"fmt"
"os"
"github.com/hashicorp/go-plugin"
"github.com/haowang0402/avalanchego/utils/logging"
"github.com/haowang0402/avalanchego/utils/ulimit"
"github.com/haowang0402/avalanchego/vms/rpcchainvm"
"github.com/haowang0402/coreth/plugin/evm"
)
func main() {
version, err := PrintVersion()
if err != nil {
fmt.Printf("couldn't get config: %s", err)
os.Exit(1)
}
if version {
fmt.Println(evm.Version)
os.Exit(0)
}
if err := ulimit.Set(ulimit.DefaultFDLimit, logging.NoLog{}); err != nil {
fmt.Printf("failed to set fd limit correctly due to: %s", err)
os.Exit(1)
}
plugin.Serve(&plugin.ServeConfig{
HandshakeConfig: rpcchainvm.Handshake,
Plugins: map[string]plugin.Plugin{
"vm": rpcchainvm.New(&evm.VM{}),
},
// A non-nil value here enables gRPC serving for this plugin...
GRPCServer: plugin.DefaultGRPCServer,
})
}