Skip to content

Commit

Permalink
[FAB-5450] Log genesis block hash while boostrapping
Browse files Browse the repository at this point in the history
Change-Id: Iee0189272d332690443ba1cf2f449325033f0b14
Signed-off-by: Jay Guo <guojiannan1101@gmail.com>
  • Loading branch information
guoger committed Aug 8, 2017
1 parent 5101b9e commit 7aae799
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion orderer/common/multichannel/registrar.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/hyperledger/fabric/orderer/common/msgprocessor"
"github.com/hyperledger/fabric/orderer/consensus"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
"github.com/hyperledger/fabric/protos/utils"
"github.com/op/go-logging"

Expand Down Expand Up @@ -107,7 +108,19 @@ func NewRegistrar(ledgerFactory ledger.Factory, consenters map[string]consensus.
signer)
r.templator = msgprocessor.NewDefaultTemplator(chain)
chain.Processor = msgprocessor.NewSystemChannel(chain, r.templator, msgprocessor.CreateSystemChannelFilters(r, chain))
logger.Infof("Starting with system channel %s and orderer type %s", chainID, chain.SharedConfig().ConsensusType())

// Retrieve genesis block to log its hash. See FAB-5450 for the purpose
iter, pos := rl.Iterator(&ab.SeekPosition{Type: &ab.SeekPosition_Oldest{Oldest: &ab.SeekOldest{}}})
defer iter.Close()
if pos != uint64(0) {
logger.Panicf("Error iterating over system channel: '%s', expected position 0, got %d", chainID, pos)
}
genesisBlock, status := iter.Next()
if status != cb.Status_SUCCESS {
logger.Panicf("Error reading genesis block of system channel '%s'", chainID)
}
logger.Infof("Starting system channel '%s' with genesis block hash %x and orderer type %s", chainID, genesisBlock.Header.Hash(), chain.SharedConfig().ConsensusType())

r.chains[chainID] = chain
r.systemChannelID = chainID
r.systemChannel = chain
Expand Down
1 change: 1 addition & 0 deletions orderer/common/server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func TestInitializeBootstrapChannel(t *testing.T) {
GenesisMethod: tc.genesisMethod,
GenesisProfile: "SampleSingleMSPSolo",
GenesisFile: "genesisblock",
SystemChannel: provisional.TestChainID,
},
}

Expand Down

0 comments on commit 7aae799

Please sign in to comment.