Commit 420f2c8b authored by David Enyeart's avatar David Enyeart Committed by Gerrit Code Review
Browse files

Merge "[FAB-10284] Fix tx-id race with sending response"

parents be8c7abc 5d5a0875
......@@ -249,8 +249,8 @@ func (h *Handler) HandleTransaction(msg *pb.ChaincodeMessage, delegate handleFun
}
chaincodeLogger.Debugf("[%s] Completed %s. Sending %s", shorttxid(msg.Txid), msg.Type, resp.Type)
h.serialSendAsync(resp, false)
h.ActiveTransactions.Remove(msg.ChannelId, msg.Txid)
h.serialSendAsync(resp, false)
}
func shorttxid(txid string) string {
......
......@@ -157,7 +157,11 @@ var _ = Describe("Handler", func() {
Expect(msg).To(Equal(expectedResponse))
})
It("deregisters the message transaction ID", func() {
It("deregisters the transaction ID before sending the response", func() {
fakeTransactionRegistry.RemoveStub = func(channelID, txID string) {
Consistently(fakeChatStream.SendCallCount).Should(Equal(0))
}
handler.HandleTransaction(incomingMessage, fakeMessageHandler.Handle)
Expect(fakeTransactionRegistry.RemoveCallCount()).To(Equal(1))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment