Commit 5d5a0875 authored by Matthew Sykes's avatar Matthew Sykes
Browse files

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



Change-Id: I6863621e0f6c9eda47e6d37027f059a4ec3028b6
Signed-off-by: default avatarMatthew Sykes <sykesmat@us.ibm.com>
parent bce57376
......@@ -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