//send chaincode events created by transactions in the block func sendChaincodeEvents(block *protos.Block) { nonHashData := block.GetNonHashData() if nonHashData != nil { trs := nonHashData.GetTransactionResults() for _, tr := range trs { if tr.ChaincodeEvent != nil { producer.Send(producer.CreateChaincodeEvent(tr.ChaincodeEvent)) } } } }
//send chaincode events created by transactions func sendChaincodeEvents(trs []*protos.TransactionResult) { if trs != nil { for _, tr := range trs { //we store empty chaincode events in the protobuf repeated array to make protobuf happy. //when we replay off a block ignore empty events if tr.ChaincodeEvent != nil && tr.ChaincodeEvent.ChaincodeID != "" { producer.Send(producer.CreateChaincodeEvent(tr.ChaincodeEvent)) } } } }
func createTestChaincodeEvent(tid string, typ string) *ehpb.Event { emsg := producer.CreateChaincodeEvent(&ehpb.ChaincodeEvent{ChaincodeID: tid, EventName: typ}) return emsg }