diff --git a/chaincfg/params.go b/chaincfg/params.go index f47d6da0..60c99ac3 100644 --- a/chaincfg/params.go +++ b/chaincfg/params.go @@ -91,6 +91,11 @@ const ( // 68, 112, and 113. DeploymentCSV + // DeploymentSegwit defines the rule change deployment ID for the + // Segragated Witness (segwit) soft-fork package. The segwit package + // includes the deployment of BIPS 141, 142, 144, 145, 147 and 173. + DeploymentSegwit + // NOTE: DefinedDeployments must always come last since it is used to // determine how many defined deployments there currently are. @@ -286,6 +291,11 @@ var MainNetParams = Params{ StartTime: 1462060800, // May 1st, 2016 ExpireTime: 1493596800, // May 1st, 2017 }, + DeploymentSegwit: { + BitNumber: 1, + StartTime: 1479168000, // November 15, 2016 UTC + ExpireTime: 1510704000, // November 15, 2017 UTC. + }, }, // Mempool parameters @@ -357,6 +367,11 @@ var RegressionNetParams = Params{ StartTime: 0, // Always available for vote ExpireTime: math.MaxInt64, // Never expires }, + DeploymentSegwit: { + BitNumber: 1, + StartTime: 0, // Always available for vote + ExpireTime: math.MaxInt64, // Never expires. + }, }, // Mempool parameters @@ -443,6 +458,11 @@ var TestNet3Params = Params{ StartTime: 1456790400, // March 1st, 2016 ExpireTime: 1493596800, // May 1st, 2017 }, + DeploymentSegwit: { + BitNumber: 1, + StartTime: 1462060800, // May 1, 2016 UTC + ExpireTime: 1493596800, // May 1, 2017 UTC. + }, }, // Mempool parameters @@ -518,6 +538,11 @@ var SimNetParams = Params{ StartTime: 0, // Always available for vote ExpireTime: math.MaxInt64, // Never expires }, + DeploymentSegwit: { + BitNumber: 1, + StartTime: 0, // Always available for vote + ExpireTime: math.MaxInt64, // Never expires. + }, }, // Mempool parameters diff --git a/integration/bip0009_test.go b/integration/bip0009_test.go index 46a7f969..181c8983 100644 --- a/integration/bip0009_test.go +++ b/integration/bip0009_test.go @@ -299,6 +299,7 @@ func TestBIP0009(t *testing.T) { t.Parallel() testBIP0009(t, "dummy", chaincfg.DeploymentTestDummy) + testBIP0009(t, "segwit", chaincfg.DeploymentSegwit) } // TestBIP0009Mining ensures blocks built via btcd's CPU miner follow the rules diff --git a/rpcserver.go b/rpcserver.go index c1534635..44af8572 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1207,8 +1207,13 @@ func handleGetBlockChainInfo(s *rpcServer, cmd interface{}, closeChan <-chan str switch deployment { case chaincfg.DeploymentTestDummy: forkName = "dummy" + case chaincfg.DeploymentCSV: forkName = "csv" + + case chaincfg.DeploymentSegwit: + forkName = "segwit" + default: return nil, &btcjson.RPCError{ Code: btcjson.ErrRPCInternal.Code,