Skip to content

Commit ebe1b4d

Browse files
committed
[FAB-FAB-2634]: Send event of genesis block committed.
After new block is committed there is an event generated, the only exception currently is for genesis block. This commit produces event after peer joins the channel and creates it for the first time. Change-Id: I99ee9f8f8a7234445517c272f9e80617f176fe56 Signed-off-by: Artem Barger <[email protected]>
1 parent 766b59c commit ebe1b4d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

core/peer/peer.go

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ func CreateChainFromBlock(cb *common.Block) error {
231231
peerLogger.Errorf("Unable to get genesis block committed into the ledger, chainID %v", cid)
232232
return err
233233
}
234+
234235
return createChain(cid, ledger, cb)
235236
}
236237

core/scc/cscc/configure.go

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/golang/protobuf/proto"
2828
"github.com/hyperledger/fabric/core/chaincode/shim"
2929
"github.com/hyperledger/fabric/core/peer"
30+
"github.com/hyperledger/fabric/events/producer"
3031
pb "github.com/hyperledger/fabric/protos/peer"
3132
"github.com/hyperledger/fabric/protos/utils"
3233
"github.com/op/go-logging"
@@ -120,6 +121,11 @@ func joinChain(blockBytes []byte) pb.Response {
120121

121122
peer.InitChain(chainID)
122123

124+
if err := producer.SendProducerBlockEvent(block); err != nil {
125+
msg := fmt.Sprintf("Error sending block event %s", err)
126+
return shim.Error(msg)
127+
}
128+
123129
return shim.Success(nil)
124130
}
125131

0 commit comments

Comments
 (0)