diff --git a/.docker/1600-privnet-blocks-single.acc.gz b/.docker/1600-privnet-blocks-single.acc.gz new file mode 100644 index 000000000..e8be800fb Binary files /dev/null and b/.docker/1600-privnet-blocks-single.acc.gz differ diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index c9dfb75bf..773e18606 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -69,3 +69,19 @@ services: - 20336:20336 - 30336:30336 - 20004:20004 + node_single: + container_name: neo_go_node_single + image: env_neo_go_image + command: "node --config-path /config --privnet" + volumes: + - ../config/protocol.privnet.docker.single.yml:/config/protocol.privnet.yml + - volume_chain:/chains + - ./1600-privnet-blocks-single.acc.gz:/privnet-blocks.acc.gz + networks: + neo_go_network: + ipv4_address: 172.200.0.1 + ports: + - 20333:20333 + - 30333:30333 + - 20001:20001 + diff --git a/Makefile b/Makefile index ecdae7062..352192676 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,10 @@ env_up: @echo "=> Bootup environment" @docker-compose -f $(DC_FILE) up -d node_one node_two node_three node_four +env_single: + @echo "=> Bootup environment" + @docker-compose -f $(DC_FILE) up -d node_single + env_down: @echo "=> Stop environment" @docker-compose -f $(DC_FILE) down diff --git a/config/protocol.privnet.docker.single.yml b/config/protocol.privnet.docker.single.yml new file mode 100644 index 000000000..2e0cdcd7e --- /dev/null +++ b/config/protocol.privnet.docker.single.yml @@ -0,0 +1,53 @@ +ProtocolConfiguration: + Magic: 56753 + AddressVersion: 23 + SecondsPerBlock: 1 + LowPriorityThreshold: 0.001 + StandbyValidators: + - 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 + SeedList: + - 172.200.0.1:20333 + SystemFee: + EnrollmentTransaction: 1000 + IssueTransaction: 500 + PublishTransaction: 500 + RegisterTransaction: 10000 + VerifyBlocks: true + VerifyTransactions: true + +ApplicationConfiguration: + # LogPath could be set up in case you need stdout logs to some proper file. + # LogPath: "./log/neogo.log" + DBConfiguration: + Type: "leveldb" #other options: 'inmemory','redis','boltdb'. + # DB type options. Uncomment those you need in case you want to switch DB type. + LevelDBOptions: + DataDirectoryPath: "/chains/single" + # RedisDBOptions: + # Addr: "localhost:6379" + # Password: "" + # DB: 0 + # BoltDBOptions: + # FilePath: "./chains/privnet.bolt" + # Uncomment in order to set up custom address for node. + # Address: 127.0.0.1 + NodePort: 20333 + Relay: true + DialTimeout: 3 + ProtoTickInterval: 2 + MaxPeers: 10 + AttemptConnPeers: 5 + MinPeers: 0 + RPC: + Enabled: true + EnableCORSWorkaround: false + Port: 30333 + Prometheus: + Enabled: true + Port: 20001 + Pprof: + Enabled: false + Port: 20011 + UnlockWallet: + Path: "6PYLmjBYJ4wQTCEfqvnznGJwZeW9pfUcV5m5oreHxqryUgqKpTRAFt9L8Y" + Password: "one" diff --git a/pkg/network/server.go b/pkg/network/server.go index c62018c7f..b0b3eef89 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -117,7 +117,7 @@ func NewServer(config ServerConfig, chain core.Blockchainer, log *zap.Logger) *S s.consensus = srv - if s.MinPeers <= 0 { + if s.MinPeers < 0 { s.log.Info("bad MinPeers configured, using the default value", zap.Int("configured", s.MinPeers), zap.Int("actual", defaultMinPeers)) @@ -158,6 +158,8 @@ func (s *Server) Start(errChan chan error) { zap.Uint32("blockHeight", s.chain.BlockHeight()), zap.Uint32("headerHeight", s.chain.HeaderHeight())) + s.tryStartConsensus() + s.discovery.BackFill(s.Seeds...) go s.bQueue.run() diff --git a/pkg/smartcontract/contract.go b/pkg/smartcontract/contract.go index 4766659ea..d1c4f7521 100644 --- a/pkg/smartcontract/contract.go +++ b/pkg/smartcontract/contract.go @@ -12,7 +12,7 @@ import ( // CreateMultiSigRedeemScript creates a script runnable by the VM. func CreateMultiSigRedeemScript(m int, publicKeys keys.PublicKeys) ([]byte, error) { - if m <= 1 { + if m < 1 { return nil, fmt.Errorf("param m cannot be smaller or equal to 1 got %d", m) } if m > len(publicKeys) {