Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 4bea613

Browse files
committed
[FAB-5908] Remove transaction proposal from error
Change-Id: I8c1f33c488ab7b8d21242770adf804c5f6ccfbcd Signed-off-by: Divyank Katira <Divyank.Katira@securekey.com>
1 parent 110bf21 commit 4bea613

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/fabric-client/peer/peerendorser.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,6 @@ func (p *peerEndorser) sendProposal(proposal apitxn.TransactionProposal) (*pb.Pr
107107
}
108108

109109
func (tpe TransactionProposalError) Error() string {
110-
return fmt.Sprintf("Transaction processor (%s) returned error '%s' for proposal: %v", tpe.Endorser, tpe.Err.Error(), tpe.Proposal)
110+
return fmt.Sprintf("Transaction processor (%s) returned error '%s' for txID '%s'",
111+
tpe.Endorser, tpe.Err.Error(), tpe.Proposal.TxnID.ID)
111112
}

pkg/fabric-client/peer/peerendorser_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"fmt"
1212
"net"
1313
"reflect"
14+
"strings"
1415
"testing"
1516
"time"
1617

@@ -265,17 +266,16 @@ func startEndorserServer(t *testing.T, grpcServer *grpc.Server) (*mocks.MockEndo
265266
func TestTransactionProposalError(t *testing.T) {
266267
var mockError error
267268

268-
proposal := mockTransactionProposal()
269269
mockError = TransactionProposalError{
270270
Endorser: "1.2.3.4:1000",
271271
Proposal: mockTransactionProposal(),
272272
Err: fmt.Errorf("error"),
273273
}
274274

275275
errText := mockError.Error()
276-
mockText := fmt.Sprintf("Transaction processor (1.2.3.4:1000) returned error 'error' for proposal: %v", proposal)
276+
mockText := "Transaction processor (1.2.3.4:1000) returned error 'error'"
277277

278-
if errText != mockText {
278+
if !strings.Contains(errText, mockText) {
279279
t.Fatalf("Unexpected error")
280280
}
281281
}

0 commit comments

Comments
 (0)