diff --git a/pkg/fabric-client/mocks/mockbroadcastserver.go b/pkg/fabric-client/mocks/mockbroadcastserver.go index 5fe13d0e8b..348ecd33d1 100644 --- a/pkg/fabric-client/mocks/mockbroadcastserver.go +++ b/pkg/fabric-client/mocks/mockbroadcastserver.go @@ -7,6 +7,8 @@ SPDX-License-Identifier: Apache-2.0 package mocks import ( + "io" + "github.com/hyperledger/fabric/protos/common" po "github.com/hyperledger/fabric/protos/orderer" ) @@ -35,17 +37,21 @@ type MockBroadcastServer struct { // Broadcast mock broadcast func (m *MockBroadcastServer) Broadcast(server po.AtomicBroadcast_BroadcastServer) error { - + _, err := server.Recv() + if err == io.EOF { + return nil + } + if err != nil { + return err + } if m.BroadcastError != nil { return m.BroadcastError } if m.BroadcastInternalServerError { - server.Send(broadcastResponseError) - return nil + return server.Send(broadcastResponseError) } - server.Send(broadcastResponseSuccess) - return nil + return server.Send(broadcastResponseSuccess) } // Deliver mock deliver