示例#1
0
//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))
			}
		}
	}
}
示例#2
0
//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))
			}
		}
	}
}
示例#3
0
func createTestChaincodeEvent(tid string, typ string) *ehpb.Event {
	emsg := producer.CreateChaincodeEvent(&ehpb.ChaincodeEvent{ChaincodeID: tid, EventName: typ})
	return emsg
}