@@ -293,8 +293,7 @@ func (f *fetcherMock) On(methodName string, arguments ...interface{}) *fetchCall
293
293
}
294
294
}
295
295
296
- func (f * fetcherMock ) fetch (dig2src dig2sources ) ([]* proto.PvtDataElement , error ) {
297
- fmt .Println ("XXX: Expected endorsers" , f .expectedEndorsers )
296
+ func (f * fetcherMock ) fetch (dig2src dig2sources , _ uint64 ) (* FetchedPvtDataContainer , error ) {
298
297
for _ , endorsements := range dig2src {
299
298
for _ , endorsement := range endorsements {
300
299
_ , exists := f .expectedEndorsers [string (endorsement .Endorser )]
@@ -309,7 +308,7 @@ func (f *fetcherMock) fetch(dig2src dig2sources) ([]*proto.PvtDataElement, error
309
308
assert .Empty (f .t , f .expectedEndorsers )
310
309
args := f .Called (dig2src )
311
310
if args .Get (1 ) == nil {
312
- return args .Get (0 ).([] * proto. PvtDataElement ), nil
311
+ return args .Get (0 ).(* FetchedPvtDataContainer ), nil
313
312
}
314
313
return nil , args .Get (1 ).(error )
315
314
}
@@ -821,15 +820,17 @@ func TestCoordinatorToFilterOutPvtRWSetsWithWrongHash(t *testing.T) {
821
820
{
822
821
TxId : "tx1" , Namespace : "ns1" , Collection : "c1" , BlockSeq : 1 ,
823
822
},
824
- }).expectingEndorsers ("org1" ).Return ([]* proto.PvtDataElement {
825
- {
826
- Digest : & proto.PvtDataDigest {
827
- BlockSeq : 1 ,
828
- Collection : "c1" ,
829
- Namespace : "ns1" ,
830
- TxId : "tx1" ,
823
+ }).expectingEndorsers ("org1" ).Return (& FetchedPvtDataContainer {
824
+ AvailableElemenets : []* proto.PvtDataElement {
825
+ {
826
+ Digest : & proto.PvtDataDigest {
827
+ BlockSeq : 1 ,
828
+ Collection : "c1" ,
829
+ Namespace : "ns1" ,
830
+ TxId : "tx1" ,
831
+ },
832
+ Payload : [][]byte {[]byte ("rws-original" )},
831
833
},
832
- Payload : [][]byte {[]byte ("rws-original" )},
833
834
},
834
835
}, nil )
835
836
store .On ("Persist" , mock .Anything , uint64 (1 ), mock .Anything ).
@@ -945,25 +946,27 @@ func TestCoordinatorStoreBlock(t *testing.T) {
945
946
{
946
947
TxId : "tx2" , Namespace : "ns2" , Collection : "c1" , BlockSeq : 1 , SeqInBlock : 1 ,
947
948
},
948
- }).expectingEndorsers ("org1" ).Return ([]* proto.PvtDataElement {
949
- {
950
- Digest : & proto.PvtDataDigest {
951
- BlockSeq : 1 ,
952
- Collection : "c2" ,
953
- Namespace : "ns1" ,
954
- TxId : "tx1" ,
949
+ }).expectingEndorsers ("org1" ).Return (& FetchedPvtDataContainer {
950
+ AvailableElemenets : []* proto.PvtDataElement {
951
+ {
952
+ Digest : & proto.PvtDataDigest {
953
+ BlockSeq : 1 ,
954
+ Collection : "c2" ,
955
+ Namespace : "ns1" ,
956
+ TxId : "tx1" ,
957
+ },
958
+ Payload : [][]byte {[]byte ("rws-pre-image" )},
955
959
},
956
- Payload : [][] byte {[] byte ( "rws-pre-image" )},
957
- },
958
- {
959
- Digest : & proto. PvtDataDigest {
960
- SeqInBlock : 1 ,
961
- BlockSeq : 1 ,
962
- Collection : "c1 " ,
963
- Namespace : "ns2" ,
964
- TxId : "tx2" ,
960
+ {
961
+ Digest : & proto. PvtDataDigest {
962
+ SeqInBlock : 1 ,
963
+ BlockSeq : 1 ,
964
+ Collection : "c1" ,
965
+ Namespace : "ns2" ,
966
+ TxId : "tx2 " ,
967
+ } ,
968
+ Payload : [][] byte {[] byte ( "rws-pre-image" )} ,
965
969
},
966
- Payload : [][]byte {[]byte ("rws-pre-image" )},
967
970
},
968
971
}, nil )
969
972
store .On ("Persist" , mock .Anything , uint64 (1 ), mock .Anything ).
@@ -994,15 +997,17 @@ func TestCoordinatorStoreBlock(t *testing.T) {
994
997
{
995
998
TxId : "tx3" , Namespace : "ns3" , Collection : "c3" , BlockSeq : 1 ,
996
999
},
997
- }).Return ([]* proto.PvtDataElement {
998
- {
999
- Digest : & proto.PvtDataDigest {
1000
- BlockSeq : 1 ,
1001
- Collection : "c3" ,
1002
- Namespace : "ns3" ,
1003
- TxId : "tx3" ,
1000
+ }).Return (& FetchedPvtDataContainer {
1001
+ AvailableElemenets : []* proto.PvtDataElement {
1002
+ {
1003
+ Digest : & proto.PvtDataDigest {
1004
+ BlockSeq : 1 ,
1005
+ Collection : "c3" ,
1006
+ Namespace : "ns3" ,
1007
+ TxId : "tx3" ,
1008
+ },
1009
+ Payload : [][]byte {[]byte ("rws-pre-image" )},
1004
1010
},
1005
- Payload : [][]byte {[]byte ("rws-pre-image" )},
1006
1011
},
1007
1012
}, nil )
1008
1013
store = & mockTransientStore {t : t }
@@ -1123,15 +1128,17 @@ func TestProceedWithoutPrivateData(t *testing.T) {
1123
1128
{
1124
1129
TxId : "tx1" , Namespace : "ns3" , Collection : "c2" , BlockSeq : 1 ,
1125
1130
},
1126
- }).Return ([]* proto.PvtDataElement {
1127
- {
1128
- Digest : & proto.PvtDataDigest {
1129
- BlockSeq : 1 ,
1130
- Collection : "c2" ,
1131
- Namespace : "ns3" ,
1132
- TxId : "tx1" ,
1131
+ }).Return (& FetchedPvtDataContainer {
1132
+ AvailableElemenets : []* proto.PvtDataElement {
1133
+ {
1134
+ Digest : & proto.PvtDataDigest {
1135
+ BlockSeq : 1 ,
1136
+ Collection : "c2" ,
1137
+ Namespace : "ns3" ,
1138
+ TxId : "tx1" ,
1139
+ },
1140
+ Payload : [][]byte {[]byte ("wrong pre-image" )},
1133
1141
},
1134
- Payload : [][]byte {[]byte ("wrong pre-image" )},
1135
1142
},
1136
1143
}, nil )
1137
1144
0 commit comments