@@ -299,6 +299,7 @@ func TestNewChannelConfig(t *testing.T) {
299
299
{
300
300
"BadConfigUpdate" ,
301
301
& cb.Payload {
302
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
302
303
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
303
304
ConfigUpdate : []byte ("bad config update envelope data" ),
304
305
}),
@@ -308,6 +309,7 @@ func TestNewChannelConfig(t *testing.T) {
308
309
{
309
310
"EmptyConfigUpdateWriteSet" ,
310
311
& cb.Payload {
312
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
311
313
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
312
314
ConfigUpdate : utils .MarshalOrPanic (
313
315
& cb.ConfigUpdate {},
@@ -319,6 +321,7 @@ func TestNewChannelConfig(t *testing.T) {
319
321
{
320
322
"WriteSetNoGroups" ,
321
323
& cb.Payload {
324
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
322
325
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
323
326
ConfigUpdate : utils .MarshalOrPanic (
324
327
& cb.ConfigUpdate {
@@ -332,6 +335,7 @@ func TestNewChannelConfig(t *testing.T) {
332
335
{
333
336
"WriteSetNoApplicationGroup" ,
334
337
& cb.Payload {
338
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
335
339
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
336
340
ConfigUpdate : utils .MarshalOrPanic (
337
341
& cb.ConfigUpdate {
@@ -347,6 +351,7 @@ func TestNewChannelConfig(t *testing.T) {
347
351
{
348
352
"BadWriteSetApplicationGroupVersion" ,
349
353
& cb.Payload {
354
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
350
355
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
351
356
ConfigUpdate : utils .MarshalOrPanic (
352
357
& cb.ConfigUpdate {
@@ -366,6 +371,7 @@ func TestNewChannelConfig(t *testing.T) {
366
371
{
367
372
"MissingWriteSetConsortiumValue" ,
368
373
& cb.Payload {
374
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
369
375
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
370
376
ConfigUpdate : utils .MarshalOrPanic (
371
377
& cb.ConfigUpdate {
@@ -386,6 +392,7 @@ func TestNewChannelConfig(t *testing.T) {
386
392
{
387
393
"BadWriteSetConsortiumValueValue" ,
388
394
& cb.Payload {
395
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
389
396
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
390
397
ConfigUpdate : utils .MarshalOrPanic (
391
398
& cb.ConfigUpdate {
@@ -410,6 +417,7 @@ func TestNewChannelConfig(t *testing.T) {
410
417
{
411
418
"UnknownConsortiumName" ,
412
419
& cb.Payload {
420
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
413
421
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
414
422
ConfigUpdate : utils .MarshalOrPanic (
415
423
& cb.ConfigUpdate {
@@ -438,6 +446,7 @@ func TestNewChannelConfig(t *testing.T) {
438
446
{
439
447
"Missing consortium members" ,
440
448
& cb.Payload {
449
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
441
450
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
442
451
ConfigUpdate : utils .MarshalOrPanic (
443
452
& cb.ConfigUpdate {
@@ -466,6 +475,7 @@ func TestNewChannelConfig(t *testing.T) {
466
475
{
467
476
"Member not in consortium" ,
468
477
& cb.Payload {
478
+ Header : & cb.Header {ChannelHeader : utils .MarshalOrPanic (utils .MakeChannelHeader (cb .HeaderType_CONFIG_UPDATE , 0 , "" , epoch ))},
469
479
Data : utils .MarshalOrPanic (& cb.ConfigUpdateEnvelope {
470
480
ConfigUpdate : utils .MarshalOrPanic (
471
481
& cb.ConfigUpdate {
@@ -505,6 +515,26 @@ func TestNewChannelConfig(t *testing.T) {
505
515
// SampleConsortium
506
516
}
507
517
518
+ func TestMismatchedChannelIDs (t * testing.T ) {
519
+ innerChannelID := "foo"
520
+ outerChannelID := "bar"
521
+ template := configtx .NewChainCreationTemplate (genesisconfig .SampleConsortiumName , nil )
522
+ configUpdateEnvelope , err := template .Envelope (innerChannelID )
523
+ createTx , err := utils .CreateSignedEnvelope (cb .HeaderType_CONFIG_UPDATE , outerChannelID , nil , configUpdateEnvelope , msgVersion , epoch )
524
+ assert .NoError (t , err )
525
+
526
+ lf , _ := NewRAMLedgerAndFactory (10 )
527
+
528
+ consenters := make (map [string ]Consenter )
529
+ consenters [conf .Orderer .OrdererType ] = & mockConsenter {}
530
+
531
+ manager := NewManagerImpl (lf , consenters , mockCrypto ())
532
+
533
+ _ , err = manager .NewChannelConfig (createTx )
534
+ assert .Error (t , err , "Mismatched channel IDs" )
535
+ assert .Regexp (t , "mismatched channel IDs" , err .Error ())
536
+ }
537
+
508
538
// This test brings up the entire system, with the mock consenter, including the broadcasters etc. and creates a new chain
509
539
func TestNewChain (t * testing.T ) {
510
540
expectedLastConfigBlockNumber := uint64 (0 )
0 commit comments