Skip to content

Commit 4e46204

Browse files
author
Jason Yellick
committed
[FAB-1433] (BUGFIX) Add batch timeout in genesis
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 <[email protected]>
1 parent 46f7af0 commit 4e46204

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

orderer/common/bootstrap/provisional/envelope.go

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func (cbs *commonBootstrapper) makeGenesisConfigEnvelope() *cb.ConfigurationEnve
2525
return utils.MakeConfigurationEnvelope(
2626
cbs.encodeConsensusType(),
2727
cbs.encodeBatchSize(),
28+
cbs.encodeBatchTimeout(),
2829
cbs.encodeChainCreators(),
2930
cbs.encodeAcceptAllPolicy(),
3031
cbs.lockDefaultModificationPolicy(),
@@ -35,6 +36,7 @@ func (kbs *kafkaBootstrapper) makeGenesisConfigEnvelope() *cb.ConfigurationEnvel
3536
return utils.MakeConfigurationEnvelope(
3637
kbs.encodeConsensusType(),
3738
kbs.encodeBatchSize(),
39+
kbs.encodeBatchTimeout(),
3840
kbs.encodeKafkaBrokers(),
3941
kbs.encodeChainCreators(),
4042
kbs.encodeAcceptAllPolicy(),

orderer/common/bootstrap/provisional/item.go

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ func (cbs *commonBootstrapper) encodeBatchSize() *cb.SignedConfigurationItem {
4545
return &cb.SignedConfigurationItem{ConfigurationItem: utils.MarshalOrPanic(configItem), Signatures: nil}
4646
}
4747

48+
func (cbs *commonBootstrapper) encodeBatchTimeout() *cb.SignedConfigurationItem {
49+
configItemKey := sharedconfig.BatchTimeoutKey
50+
configItemValue := utils.MarshalOrPanic(&ab.BatchTimeout{Timeout: cbs.batchTimeout})
51+
modPolicy := configtx.DefaultModificationPolicyID
52+
53+
configItemChainHeader := utils.MakeChainHeader(cb.HeaderType_CONFIGURATION_ITEM, msgVersion, cbs.chainID, epoch)
54+
configItem := utils.MakeConfigurationItem(configItemChainHeader, cb.ConfigurationItem_Orderer, lastModified, modPolicy, configItemKey, configItemValue)
55+
return &cb.SignedConfigurationItem{ConfigurationItem: utils.MarshalOrPanic(configItem), Signatures: nil}
56+
}
57+
4858
func (cbs *commonBootstrapper) encodeChainCreators() *cb.SignedConfigurationItem {
4959
configItemKey := sharedconfig.ChainCreatorsKey
5060
configItemValue := utils.MarshalOrPanic(&ab.ChainCreators{Policies: DefaultChainCreators})

orderer/common/bootstrap/provisional/provisional.go

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type commonBootstrapper struct {
5757
chainID string
5858
consensusType string
5959
batchSize *ab.BatchSize
60+
batchTimeout string
6061
}
6162

6263
type soloBootstrapper struct {
@@ -76,6 +77,7 @@ func New(conf *config.TopLevel) bootstrap.Helper {
7677
batchSize: &ab.BatchSize{
7778
MaxMessageCount: conf.General.BatchSize.MaxMessageCount,
7879
},
80+
batchTimeout: conf.General.BatchTimeout.String(),
7981
}
8082

8183
switch conf.General.OrdererType {

0 commit comments

Comments
 (0)