Refactor of the Go node (#44)

* added headersOp for safely processing headers

* Better handling of protocol messages.

* housekeeping + cleanup tests

* Added more blockchain logic + unit tests

* fixed unreachable error.

* added structured logging for all (node) components.

* added relay flag + bumped version
This commit is contained in:
Anthony De Meulemeester 2018-03-09 16:55:25 +01:00 committed by GitHub
parent b2a5e34aac
commit 4023661cf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 1497 additions and 1265 deletions

View file

@ -16,6 +16,7 @@ func NewCommand() cli.Command {
Flags: []cli.Flag{
cli.IntFlag{Name: "tcp"},
cli.IntFlag{Name: "rpc"},
cli.BoolFlag{Name: "relay, r"},
cli.StringFlag{Name: "seed"},
cli.BoolFlag{Name: "privnet, p"},
cli.BoolFlag{Name: "mainnet, m"},
@ -25,12 +26,6 @@ func NewCommand() cli.Command {
}
func startServer(ctx *cli.Context) error {
opts := network.StartOpts{
Seeds: parseSeeds(ctx.String("seed")),
TCP: ctx.Int("tcp"),
RPC: ctx.Int("rpc"),
}
net := network.ModePrivNet
if ctx.Bool("testnet") {
net = network.ModeTestNet
@ -39,8 +34,16 @@ func startServer(ctx *cli.Context) error {
net = network.ModeMainNet
}
s := network.NewServer(net)
s.Start(opts)
cfg := network.Config{
UserAgent: "/NEO-GO:0.26.0/",
ListenTCP: uint16(ctx.Int("tcp")),
Seeds: parseSeeds(ctx.String("seed")),
Net: net,
Relay: ctx.Bool("relay"),
}
s := network.NewServer(cfg)
s.Start()
return nil
}