OSDN Git Service

add fedd dockerfile (#339)
[bytom/vapor.git] / consensus / general.go
index 8598e82..32620ac 100644 (file)
@@ -99,54 +99,53 @@ type Params struct {
        ProducerSubsidys []ProducerSubsidy
 }
 
-// VaporDPOSConfig return the dpos consensus config
-func VaporDPOSConfig() DPOSConfig {
-       dpos := DPOSConfig{
-               NumOfConsensusNode:      10,
-               BlockNumEachNode:        12,
-               MinConsensusNodeVoteNum: uint64(100000000000000),
-               MinVoteOutputAmount:     uint64(100000000),
-               BlockTimeInterval:       500,
-       }
-
-       dpos.RoundVoteBlockNums = uint64(uint64(dpos.NumOfConsensusNode) * dpos.BlockNumEachNode * 10)
-       dpos.MaxTimeOffsetMs = uint64(uint64(dpos.BlockTimeInterval) * dpos.BlockNumEachNode / 3)
-       return dpos
-}
-
 // ActiveNetParams is the active NetParams
-var ActiveNetParams = VaporNetParams
+var ActiveNetParams = MainNetParams
 
 // NetParams is the correspondence between chain_id and Params
 var NetParams = map[string]Params{
        "mainnet": MainNetParams,
-       "wisdom":  TestNetParams,
-       "vapor":   VaporNetParams,
+       "testnet": TestNetParams,
        "solonet": SoloNetParams,
 }
 
-// MainNetParams is the config for bytom main-net
+// MainNetParams is the config for vapor-mainnet
 var MainNetParams = Params{
        Name:            "main",
-       Bech32HRPSegwit: "bm",
-       DefaultPort:     "46657",
-       DNSSeeds:        []string{"www.mainnetseed.bytom.io"},
-       Checkpoints:     []Checkpoint{},
+       Bech32HRPSegwit: "vp",
+       DefaultPort:     "56656",
+       DNSSeeds:        []string{"www.mainnetseed.vapor.io"},
+       BasicConfig: BasicConfig{
+               MaxBlockGas:                uint64(10000000),
+               MaxGasAmount:               int64(640000),
+               DefaultGasCredit:           int64(160000),
+               StorageGasRate:             int64(1),
+               VMGasRate:                  int64(200),
+               VotePendingBlockNumber:     uint64(3456000),
+               CoinbasePendingBlockNumber: uint64(7200),
+               CoinbaseArbitrarySizeLimit: 128,
+       },
+       DPOSConfig: DPOSConfig{
+               NumOfConsensusNode:      10,
+               BlockNumEachNode:        12,
+               MinConsensusNodeVoteNum: uint64(100000000000000),
+               MinVoteOutputAmount:     uint64(100000000),
+               BlockTimeInterval:       500,
+               RoundVoteBlockNums:      1200,
+               MaxTimeOffsetMs:         2000,
+       },
+       Checkpoints: []Checkpoint{},
+       ProducerSubsidys: []ProducerSubsidy{
+               {BeginBlock: 1, EndBlock: 63072000, Subsidy: 9512938},
+       },
 }
 
-// TestNetParams is the config for bytom test-net
+// TestNetParams is the config for vapor-testnet
 var TestNetParams = Params{
        Name:            "test",
-       Bech32HRPSegwit: "tm",
-       DefaultPort:     "46656",
-       DNSSeeds:        []string{"www.testnetseed.bytom.io"},
-       Checkpoints:     []Checkpoint{},
-}
-
-// VaporNetParams is the config for vapor-net
-var VaporNetParams = Params{
-       Name:            "vapor",
-       Bech32HRPSegwit: "vp",
+       Bech32HRPSegwit: "tp",
+       DefaultPort:     "56657",
+       DNSSeeds:        []string{"www.testnetseed.vapor.io"},
        BasicConfig: BasicConfig{
                MaxBlockGas:                uint64(10000000),
                MaxGasAmount:               int64(200000),
@@ -154,20 +153,29 @@ var VaporNetParams = Params{
                StorageGasRate:             int64(1),
                VMGasRate:                  int64(200),
                VotePendingBlockNumber:     uint64(10000),
-               CoinbasePendingBlockNumber: uint64(100),
+               CoinbasePendingBlockNumber: uint64(1200),
                CoinbaseArbitrarySizeLimit: 128,
        },
-       DPOSConfig:  VaporDPOSConfig(),
+       DPOSConfig: DPOSConfig{
+               NumOfConsensusNode:      10,
+               BlockNumEachNode:        12,
+               MinConsensusNodeVoteNum: uint64(100000000000000),
+               MinVoteOutputAmount:     uint64(100000000),
+               BlockTimeInterval:       500,
+               RoundVoteBlockNums:      1200,
+               MaxTimeOffsetMs:         2000,
+       },
        Checkpoints: []Checkpoint{},
        ProducerSubsidys: []ProducerSubsidy{
                {BeginBlock: 1, EndBlock: 63072000, Subsidy: 15000000},
        },
 }
 
-// SoloNetParams is the config for solo test-net
+// SoloNetParams is the config for vapor solonet
 var SoloNetParams = Params{
        Name:            "solo",
-       Bech32HRPSegwit: "sm",
+       Bech32HRPSegwit: "sp",
+       DefaultPort:     "56658",
        BasicConfig: BasicConfig{
                MaxBlockGas:                uint64(10000000),
                MaxGasAmount:               int64(200000),
@@ -175,10 +183,18 @@ var SoloNetParams = Params{
                StorageGasRate:             int64(1),
                VMGasRate:                  int64(200),
                VotePendingBlockNumber:     uint64(10000),
-               CoinbasePendingBlockNumber: uint64(100),
+               CoinbasePendingBlockNumber: uint64(1200),
                CoinbaseArbitrarySizeLimit: 128,
        },
-       DPOSConfig:  VaporDPOSConfig(),
+       DPOSConfig: DPOSConfig{
+               NumOfConsensusNode:      10,
+               BlockNumEachNode:        12,
+               MinConsensusNodeVoteNum: uint64(100000000000000),
+               MinVoteOutputAmount:     uint64(100000000),
+               BlockTimeInterval:       500,
+               RoundVoteBlockNums:      1200,
+               MaxTimeOffsetMs:         2000,
+       },
        Checkpoints: []Checkpoint{},
        ProducerSubsidys: []ProducerSubsidy{
                {BeginBlock: 0, EndBlock: 0, Subsidy: 24},
@@ -197,3 +213,15 @@ func BlockSubsidy(height uint64) uint64 {
        }
        return 0
 }
+
+// BytomMainNetParams is the config for bytom mainnet
+func BytomMainNetParams(vaporParam *Params) *Params {
+       bech32HRPSegwit := "sm"
+       switch vaporParam.Name {
+       case "main":
+               bech32HRPSegwit = "bm"
+       case "test":
+               bech32HRPSegwit = "tm"
+       }
+       return &Params{Bech32HRPSegwit: bech32HRPSegwit}
+}