Commit e267b7ec authored by Kostas Christidis's avatar Kostas Christidis Committed by Gerrit Code Review
Browse files

Merge "[FAB-5236] System channel ID should be configurable"

parents cd6e2c61 452c7eb8
......@@ -32,6 +32,7 @@ import (
"path/filepath"
bccsp "github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/common/configtx/tool/provisional"
)
const (
......@@ -74,6 +75,7 @@ type General struct {
TLS TLS
GenesisMethod string
GenesisProfile string
SystemChannel string
GenesisFile string
Profile Profile
LogLevel string
......@@ -167,6 +169,7 @@ var defaults = TopLevel{
ListenPort: 7050,
GenesisMethod: "provisional",
GenesisProfile: "SampleSingleMSPSolo",
SystemChannel: provisional.TestChainID,
GenesisFile: "genesisblock",
Profile: Profile{
Enabled: false,
......@@ -276,6 +279,8 @@ func (c *TopLevel) completeInitialization(configDir string) {
c.General.GenesisFile = defaults.General.GenesisFile
case c.General.GenesisProfile == "":
c.General.GenesisProfile = defaults.General.GenesisProfile
case c.General.SystemChannel == "":
c.General.SystemChannel = defaults.General.SystemChannel
case c.Kafka.TLS.Enabled && c.Kafka.TLS.Certificate == "":
logger.Panicf("General.Kafka.TLS.Certificate must be set if General.Kafka.TLS.Enabled is set to true.")
......
......@@ -24,6 +24,7 @@ import (
"testing"
"time"
"github.com/hyperledger/fabric/common/configtx/tool/provisional"
"github.com/stretchr/testify/assert"
)
......@@ -111,6 +112,11 @@ func TestKafkaTLSConfig(t *testing.T) {
}
}
func TestSystemChannel(t *testing.T) {
conf := Load()
assert.Equal(t, provisional.TestChainID, conf.General.SystemChannel, "System channel ID should be '%s' by default", provisional.TestChainID)
}
func TestProfileConfig(t *testing.T) {
uconf := &TopLevel{General: General{Profile: Profile{Enabled: true}}}
uconf.completeInitialization(DummyPath)
......
......@@ -146,7 +146,7 @@ func initializeBootstrapChannel(conf *config.TopLevel, lf ledger.Factory) {
// Select the bootstrapping mechanism
switch conf.General.GenesisMethod {
case "provisional":
genesisBlock = provisional.New(genesisconfig.Load(conf.General.GenesisProfile)).GenesisBlock()
genesisBlock = provisional.New(genesisconfig.Load(conf.General.GenesisProfile)).GenesisBlockForChannel(conf.General.SystemChannel)
case "file":
genesisBlock = file.New(conf.General.GenesisFile).GenesisBlock()
default:
......
......@@ -19,12 +19,12 @@ import (
"github.com/Shopify/sarama"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/common/configtx/tool/provisional"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/common/localmsp"
coreconfig "github.com/hyperledger/fabric/core/config"
config "github.com/hyperledger/fabric/orderer/common/localconfig"
logging "github.com/op/go-logging"
// logging "github.com/op/go-logging"
"github.com/hyperledger/fabric/orderer/common/localconfig"
"github.com/op/go-logging"
"github.com/stretchr/testify/assert"
)
......@@ -164,9 +164,10 @@ func TestInitializeBootstrapChannel(t *testing.T) {
initializeBootstrapChannel(bootstrapConfig, ledgerFactory)
})
} else {
initializeBootstrapChannel(bootstrapConfig, ledgerFactory)
assert.NotPanics(t, func() {
initializeBootstrapChannel(bootstrapConfig, ledgerFactory)
})
}
})
}
}
......@@ -216,6 +217,7 @@ func TestInitializeMultiChainManager(t *testing.T) {
LedgerType: "ram",
GenesisMethod: "provisional",
GenesisProfile: "SampleSingleMSPSolo",
SystemChannel: provisional.TestChainID,
LocalMSPDir: localMSPDir,
LocalMSPID: "DEFAULT",
BCCSP: &factory.FactoryOpts{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment