package config
import (
- "math/big"
"os"
"os/user"
"path/filepath"
Side *SideChainConfig `mapstructure:"side"`
MainChain *MainChainRpcConfig `mapstructure:"mainchain"`
Websocket *WebsocketConfig `mapstructure:"ws"`
+ Consensus *ConsensusConfig `mapstructure:"consensus"`
}
// Default configurable parameters.
Side: DefaultSideChainConfig(),
MainChain: DefaultMainChainRpc(),
Websocket: DefaultWebsocketConfig(),
+ Consensus: DefaultConsensusCOnfig(),
}
}
// log file name
LogFile string `mapstructure:"log_file"`
- //Validate pegin proof by checking bytom transaction inclusion in mainchain.
+ // Validate pegin proof by checking bytom transaction inclusion in mainchain.
ValidatePegin bool `mapstructure:"validate_pegin"`
Signer string `mapstructure:"signer"`
+
+ ConsensusConfigFile string `mapstructure:"consensus_config_file"`
+
+ IpfsAddress string `mapstructure:"ipfs_addr"`
}
// Default configurable base parameters.
DBBackend: "leveldb",
DBPath: "data",
KeysPath: "keystore",
+ IpfsAddress: "127.0.0.1:5001",
}
}
MaxNumConcurrentReqs int `mapstructure:"max_num_concurrent_reqs"`
}
+type ConsensusConfig struct {
+ Type string `mapstructure:"consensus_type"`
+ Period uint64 `json:"period"` // Number of seconds between blocks to enforce
+ MaxSignerCount uint64 `json:"max_signers_count"` // Max count of signers
+ MinVoterBalance uint64 `json:"min_boter_balance"` // Min voter balance to valid this vote
+ GenesisTimestamp uint64 `json:"genesis_timestamp"` // The LoopStartTime of first Block
+ Coinbase string `json:"coinbase"`
+ XPrv string `json:"xprv"`
+ SelfVoteSigners []string `json:"signers"` // Signers vote by themselves to seal the block, make sure the signer accounts are pre-funded
+ Signers []common.Address
+}
+
type DposConfig struct {
- Period uint64 `json:"period"` // Number of seconds between blocks to enforce
- Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
- MaxSignerCount uint64 `json:"max_signers_count"` // Max count of signers
- MinVoterBalance *big.Int `json:"min_boter_balance"` // Min voter balance to valid this vote
- GenesisTimestamp uint64 `json:"genesis_timestamp"` // The LoopStartTime of first Block
- SelfVoteSigners []common.Address `json:"signers"` // Signers vote by themselves to seal the block, make sure the signer accounts are pre-funded
+ Period uint64 `json:"period"` // Number of seconds between blocks to enforce
+ MaxSignerCount uint64 `json:"max_signers_count"` // Max count of signers
+ MinVoterBalance uint64 `json:"min_boter_balance"` // Min voter balance to valid this vote
+ GenesisTimestamp uint64 `json:"genesis_timestamp"` // The LoopStartTime of first Block
+ Coinbase string `json:"coinbase"`
+ XPrv string `json:"xprv"`
+ SelfVoteSigners []string `json:"signers"` // Signers vote by themselves to seal the block, make sure the signer accounts are pre-funded
+ Signers []common.Address
}
// Default configurable rpc's auth parameters.
}
}
+func DefaultDposConfig() *DposConfig {
+ return &DposConfig{
+ Period: 1,
+ MaxSignerCount: 1,
+ MinVoterBalance: 0,
+ GenesisTimestamp: 1524549600,
+ }
+}
+
+func DefaultConsensusCOnfig() *ConsensusConfig {
+ return &ConsensusConfig{
+ Type: "dpos",
+ Period: 1,
+ MaxSignerCount: 1,
+ MinVoterBalance: 0,
+ GenesisTimestamp: 1524549600}
+}
+
//-----------------------------------------------------------------------------
// Utils