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

Commit 2f93a32

Browse files
Fix Gateway Evaluate ignoring endpoint option (#153)
* Fix Gateway Evaluate ignoring endpoint option This PR fixes the issue FABG-1019. The current implementation of Transaction Evalaute ignores the endorsing peers option when set. This leads to unexpected behavor when txn object is used to perform evaluate and submit. Signed-off-by: Marcus Brandenburger <[email protected]> * fixup! Fix Gateway Evaluate ignoring endpoint option Signed-off-by: Marcus Brandenburger <[email protected]>
1 parent a6ea771 commit 2f93a32

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pkg/gateway/transaction.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ func (txn *Transaction) Evaluate(args ...string) ([]byte, error) {
8686
txn.request.Args = bytes
8787

8888
var options []channel.RequestOption
89+
if txn.endorsingPeers != nil {
90+
options = append(options, channel.WithTargetEndpoints(txn.endorsingPeers...))
91+
}
8992
options = append(options, channel.WithTimeout(fab.Query, txn.contract.network.gateway.options.Timeout))
9093

9194
response, err := txn.contract.client.Query(

pkg/gateway/transaction_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func TestTransactionOptions(t *testing.T) {
7070
t.Fatalf("Incorrect endorsing peer: %s", endorsers[0])
7171
}
7272

73+
txn.Evaluate("arg1", "arg2")
7374
txn.Submit("arg1", "arg2")
7475
}
7576

0 commit comments

Comments
 (0)