@@ -21,18 +21,17 @@ import (
21
21
"testing"
22
22
"time"
23
23
24
+ "github.com/golang/protobuf/proto"
25
+ "github.com/hyperledger/fabric/common/configtx"
24
26
"github.com/hyperledger/fabric/common/genesis"
25
27
"github.com/hyperledger/fabric/protos/common"
26
28
"github.com/hyperledger/fabric/protos/peer"
27
- "github.com/golang/protobuf/proto"
28
- "github.com/stretchr/testify/assert"
29
- "github.com/hyperledger/fabric/common/configtx"
30
29
"github.com/hyperledger/fabric/protos/utils"
30
+ "github.com/stretchr/testify/assert"
31
31
)
32
32
33
33
type blockInvalidator func (* common.Block ) * common.Block
34
34
35
-
36
35
// unMarshaller is a mock for proto.Unmarshal
37
36
// that fails on an Nth attempt
38
37
type unMarshaller struct {
@@ -47,7 +46,7 @@ func (um *unMarshaller) unMarshal(buf []byte, pb proto.Message) error {
47
46
return proto .Unmarshal (buf , pb )
48
47
}
49
48
50
- func failUnmarshallAtAttempt (attempts int ) func (buf []byte , pb proto.Message ) error {
49
+ func failUnmarshallAtAttempt (attempts int ) func (buf []byte , pb proto.Message ) error {
51
50
um := & unMarshaller {attemptsLeft : attempts }
52
51
return um .unMarshal
53
52
}
@@ -104,7 +103,6 @@ func TestInvalidJoinChannelBlock(t *testing.T) {
104
103
}
105
104
testJoinChannelFails (t , multipleAnchorPeers , nil )
106
105
107
-
108
106
noAnchorPeers := func (_ * common.Block ) * common.Block {
109
107
anchorPeers := & peer.AnchorPeers {
110
108
AnchorPees : []* peer.AnchorPeer {},
@@ -137,7 +135,6 @@ func TestValidJoinChannelBlock(t *testing.T) {
137
135
assert .Equal (t , []byte ("cert" ), []byte (jcm .AnchorPeers ()[0 ].Cert ))
138
136
}
139
137
140
-
141
138
func testJoinChannelFails (t * testing.T , invalidator blockInvalidator , unMarshallFunc func (buf []byte , pb proto.Message ) error ) {
142
139
if unMarshallFunc != nil {
143
140
unMarshal = unMarshallFunc
@@ -155,7 +152,6 @@ func testJoinChannelFails(t *testing.T, invalidator blockInvalidator, unMarshall
155
152
unMarshal = proto .Unmarshal
156
153
}
157
154
158
-
159
155
func createValidJoinChanMessage (t * testing.T , seqNum int , host string , port int , cert []byte ) * common.Block {
160
156
anchorPeers := & peer.AnchorPeers {
161
157
AnchorPees : []* peer.AnchorPeer {{Cert : cert , Host : host , Port : int32 (port )}},
@@ -181,4 +177,4 @@ func createAnchorPeerConfItem(t *testing.T, anchorPeers *peer.AnchorPeers, key s
181
177
Type : common .ConfigurationItem_Peer ,
182
178
Value : serializedAnchorPeers ,
183
179
}
184
- }
180
+ }
0 commit comments