Skip to content

Commit ed1c33a

Browse files
committed
Revert - Check status of all proposal responses
This reverts commit d9b03e9. When applied to master, tests began to fail. FAB-16149 Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> Change-Id: I01b7eed453a62b9858290f58e4880a4bcb7d2d91
1 parent 27f9b9c commit ed1c33a

File tree

2 files changed

+16
-35
lines changed

2 files changed

+16
-35
lines changed

protoutil/txutils.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,11 @@ func CreateSignedTx(
178178
// ensure that all actions are bitwise equal and that they are successful
179179
var a1 []byte
180180
for n, r := range resps {
181-
if r.Response.Status < 200 || r.Response.Status >= 400 {
182-
return nil, errors.Errorf("proposal response was not successful, error code %d, msg %s", r.Response.Status, r.Response.Message)
183-
}
184-
185181
if n == 0 {
186182
a1 = r.Payload
183+
if r.Response.Status < 200 || r.Response.Status >= 400 {
184+
return nil, errors.Errorf("proposal response was not successful, error code %d, msg %s", r.Response.Status, r.Response.Message)
185+
}
187186
continue
188187
}
189188

protoutil/txutils_test.go

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -159,39 +159,21 @@ func TestCreateSignedTx(t *testing.T) {
159159
})
160160
prop.Header = headerBytes
161161

162-
nonMatchingTests := []struct {
163-
responses []*pb.ProposalResponse
164-
expectedError string
165-
}{
166-
// good responses, but different payloads
167-
{
168-
[]*pb.ProposalResponse{
169-
{Payload: []byte("payload"), Response: &pb.Response{Status: int32(200)}},
170-
{Payload: []byte("payload2"), Response: &pb.Response{Status: int32(200)}},
171-
},
172-
"ProposalResponsePayloads do not match",
173-
},
174-
// good response followed by bad response
175-
{
176-
[]*pb.ProposalResponse{
177-
{Payload: []byte("payload"), Response: &pb.Response{Status: int32(200)}},
178-
{Payload: []byte{}, Response: &pb.Response{Status: int32(500), Message: "failed to endorse"}},
179-
},
180-
"proposal response was not successful, error code 500, msg failed to endorse",
162+
// non-matching responses
163+
responses = []*pb.ProposalResponse{{
164+
Payload: []byte("payload"),
165+
Response: &pb.Response{
166+
Status: int32(200),
181167
},
182-
// bad response followed by good response
183-
{
184-
[]*pb.ProposalResponse{
185-
{Payload: []byte{}, Response: &pb.Response{Status: int32(500), Message: "failed to endorse"}},
186-
{Payload: []byte("payload"), Response: &pb.Response{Status: int32(200)}},
187-
},
188-
"proposal response was not successful, error code 500, msg failed to endorse",
168+
}}
169+
responses = append(responses, &pb.ProposalResponse{
170+
Payload: []byte("payload2"),
171+
Response: &pb.Response{
172+
Status: int32(200),
189173
},
190-
}
191-
for i, nonMatchingTest := range nonMatchingTests {
192-
_, err = protoutil.CreateSignedTx(prop, signID, nonMatchingTest.responses...)
193-
assert.EqualErrorf(t, err, nonMatchingTest.expectedError, "Expected non-matching response error '%v' for test %d", nonMatchingTest.expectedError, i)
194-
}
174+
})
175+
_, err = protoutil.CreateSignedTx(prop, signID, responses...)
176+
assert.Error(t, err, "Expected error with non-matching responses")
195177

196178
// no endorsement
197179
responses = []*pb.ProposalResponse{{

0 commit comments

Comments
 (0)