Skip to content

Commit

Permalink
[FAB-1433] (BUGFIX) Add batch timeout in genesis
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-1443
https://gerrit.hyperledger.org/r/#/c/3461/

The above changeset fixed a TODO to have the batch timeout retrieved via
the shared config mechanism from the genesis block, but it did not
actually encode the batch timeout into the genesis block.  This was
causing a batch timeout of 0s and was breaking the bdd tests.

This changeset adds the encoding of the batch timeout to the provisional
bootstrapper.

Change-Id: I938b4aa89b2a2a5d3ca049129a32b3a8ec37832e
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Jan 3, 2017
1 parent 46f7af0 commit 4e46204
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions orderer/common/bootstrap/provisional/envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func (cbs *commonBootstrapper) makeGenesisConfigEnvelope() *cb.ConfigurationEnve
return utils.MakeConfigurationEnvelope(
cbs.encodeConsensusType(),
cbs.encodeBatchSize(),
cbs.encodeBatchTimeout(),
cbs.encodeChainCreators(),
cbs.encodeAcceptAllPolicy(),
cbs.lockDefaultModificationPolicy(),
Expand All @@ -35,6 +36,7 @@ func (kbs *kafkaBootstrapper) makeGenesisConfigEnvelope() *cb.ConfigurationEnvel
return utils.MakeConfigurationEnvelope(
kbs.encodeConsensusType(),
kbs.encodeBatchSize(),
kbs.encodeBatchTimeout(),
kbs.encodeKafkaBrokers(),
kbs.encodeChainCreators(),
kbs.encodeAcceptAllPolicy(),
Expand Down
10 changes: 10 additions & 0 deletions orderer/common/bootstrap/provisional/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ func (cbs *commonBootstrapper) encodeBatchSize() *cb.SignedConfigurationItem {
return &cb.SignedConfigurationItem{ConfigurationItem: utils.MarshalOrPanic(configItem), Signatures: nil}
}

func (cbs *commonBootstrapper) encodeBatchTimeout() *cb.SignedConfigurationItem {
configItemKey := sharedconfig.BatchTimeoutKey
configItemValue := utils.MarshalOrPanic(&ab.BatchTimeout{Timeout: cbs.batchTimeout})
modPolicy := configtx.DefaultModificationPolicyID

configItemChainHeader := utils.MakeChainHeader(cb.HeaderType_CONFIGURATION_ITEM, msgVersion, cbs.chainID, epoch)
configItem := utils.MakeConfigurationItem(configItemChainHeader, cb.ConfigurationItem_Orderer, lastModified, modPolicy, configItemKey, configItemValue)
return &cb.SignedConfigurationItem{ConfigurationItem: utils.MarshalOrPanic(configItem), Signatures: nil}
}

func (cbs *commonBootstrapper) encodeChainCreators() *cb.SignedConfigurationItem {
configItemKey := sharedconfig.ChainCreatorsKey
configItemValue := utils.MarshalOrPanic(&ab.ChainCreators{Policies: DefaultChainCreators})
Expand Down
2 changes: 2 additions & 0 deletions orderer/common/bootstrap/provisional/provisional.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type commonBootstrapper struct {
chainID string
consensusType string
batchSize *ab.BatchSize
batchTimeout string
}

type soloBootstrapper struct {
Expand All @@ -76,6 +77,7 @@ func New(conf *config.TopLevel) bootstrap.Helper {
batchSize: &ab.BatchSize{
MaxMessageCount: conf.General.BatchSize.MaxMessageCount,
},
batchTimeout: conf.General.BatchTimeout.String(),
}

switch conf.General.OrdererType {
Expand Down

0 comments on commit 4e46204

Please sign in to comment.