MCPcopy
hub / github.com/hyperledger/fabric / registerForDeliverEvent

Function registerForDeliverEvent

integration/pvtdata/pvtdata_test.go:1108–1135  ·  view source on GitHub ↗
(
	ctx context.Context,
	network *nwo.Network,
	peer *nwo.Peer,
	channelID string,
	signingIdentity *nwo.SigningIdentity,
	blockNum uint64,
)

Source from the content-addressed store, hash-verified

1106}
1107
1108func registerForDeliverEvent(
1109 ctx context.Context,
1110 network *nwo.Network,
1111 peer *nwo.Peer,
1112 channelID string,
1113 signingIdentity *nwo.SigningIdentity,
1114 blockNum uint64,
1115) (<-chan deliverEvent, *grpc.ClientConn) {
1116 // create a grpc.ClientConn
1117 conn := network.PeerClientConn(peer)
1118
1119 dp, err := pb.NewDeliverClient(conn).DeliverWithPrivateData(ctx)
1120 Expect(err).NotTo(HaveOccurred())
1121
1122 // send a deliver request
1123 envelope, err := createDeliverEnvelope(channelID, signingIdentity, blockNum)
1124 Expect(err).NotTo(HaveOccurred())
1125 err = dp.Send(envelope)
1126 Expect(err).NotTo(HaveOccurred())
1127 err = dp.CloseSend()
1128 Expect(err).NotTo(HaveOccurred())
1129
1130 // create a goroutine to receive the response in a separate thread
1131 eventCh := make(chan deliverEvent, 1)
1132 go receiveDeliverResponse(dp, peer, eventCh)
1133
1134 return eventCh, conn
1135}
1136
1137// receiveDeliverResponse expects to receive the BlockAndPrivateData response for the requested block.
1138func receiveDeliverResponse(dp pb.Deliver_DeliverWithPrivateDataClient, peer *nwo.Peer, eventCh chan<- deliverEvent) {

Callers 1

Calls 6

receiveDeliverResponseFunction · 0.85
PeerClientConnMethod · 0.80
createDeliverEnvelopeFunction · 0.70
SendMethod · 0.65
CloseSendMethod · 0.65

Tested by

no test coverage detected