network: allow single-node privnet setup

This commit is contained in:
Evgenii Stratonikov 2020-01-13 15:22:21 +03:00
parent b33ca04191
commit 70b23076f8
6 changed files with 77 additions and 2 deletions

Binary file not shown.

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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()

View file

@ -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) {