Skip to content

Commit

Permalink
[FAB-FAB-2634]: Send event of genesis block committed.
Browse files Browse the repository at this point in the history
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 <bartem@il.ibm.com>
  • Loading branch information
C0rWin committed Mar 4, 2017
1 parent 766b59c commit ebe1b4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ func CreateChainFromBlock(cb *common.Block) error {
peerLogger.Errorf("Unable to get genesis block committed into the ledger, chainID %v", cid)
return err
}

return createChain(cid, ledger, cb)
}

Expand Down
6 changes: 6 additions & 0 deletions core/scc/cscc/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/peer"
"github.com/hyperledger/fabric/events/producer"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/hyperledger/fabric/protos/utils"
"github.com/op/go-logging"
Expand Down Expand Up @@ -120,6 +121,11 @@ func joinChain(blockBytes []byte) pb.Response {

peer.InitChain(chainID)

if err := producer.SendProducerBlockEvent(block); err != nil {
msg := fmt.Sprintf("Error sending block event %s", err)
return shim.Error(msg)
}

return shim.Success(nil)
}

Expand Down

0 comments on commit ebe1b4d

Please sign in to comment.