@@ -103,6 +103,26 @@ func (c *Channel) Ledger() ledger.PeerLedger {
103
103
return c .ledger
104
104
}
105
105
106
+ func (c * Channel ) Resources () channelconfig.Resources {
107
+ return c .resources
108
+ }
109
+
110
+ func (c * Channel ) ConfigBlock () * common.Block {
111
+ return c .cb
112
+ }
113
+
114
+ func (c * Channel ) setConfigBlock (cb * common.Block ) {
115
+ c .cb = cb
116
+ }
117
+
118
+ func (c * Channel ) BundleSource () * channelconfig.BundleSource {
119
+ return c .bundleSource
120
+ }
121
+
122
+ func (c * Channel ) Store () transientstore.Store {
123
+ return c .store
124
+ }
125
+
106
126
func (c * Channel ) Reader () blockledger.Reader {
107
127
return fileledger .NewFileLedger (fileLedgerBlockStore {c .ledger })
108
128
}
@@ -176,10 +196,6 @@ func (c *Channel) MSPManager() msp.MSPManager {
176
196
return c .resources .MSPManager ()
177
197
}
178
198
179
- func (c * Channel ) Store () transientstore.Store {
180
- return c .store
181
- }
182
-
183
199
func getCurrConfigBlockFromLedger (ledger ledger.PeerLedger ) (* common.Block , error ) {
184
200
peerLogger .Debugf ("Getting config block" )
185
201
@@ -316,7 +332,7 @@ func buildTrustedRootsForChain(cm channelconfig.Resources) {
316
332
// setCurrConfigBlock sets the current config block of the specified channel
317
333
func (p * Peer ) setCurrConfigBlock (block * common.Block , cid string ) error {
318
334
if c := p .Channel (cid ); c != nil {
319
- c .cb = block // TODO: serialization?
335
+ c .setConfigBlock ( block )
320
336
return nil
321
337
}
322
338
return errors .Errorf ("[channel %s] channel not associated with this peer" , cid )
@@ -379,7 +395,7 @@ func (*configSupport) GetChannelConfig(cid string) cc.Config {
379
395
peerLogger .Errorf ("[channel %s] channel not associated with this peer" , cid )
380
396
return nil
381
397
}
382
- return channel .bundleSource .ConfigtxValidator ()
398
+ return channel .BundleSource () .ConfigtxValidator ()
383
399
}
384
400
385
401
// Operations exposes an interface to the package level functions that operated
@@ -600,7 +616,7 @@ func (p *Peer) Channel(cid string) *Channel {
600
616
601
617
func (p * Peer ) StoreForChannel (cid string ) transientstore.Store {
602
618
if c := p .Channel (cid ); c != nil {
603
- return c .store
619
+ return c .Store ()
604
620
}
605
621
return nil
606
622
}
@@ -609,7 +625,7 @@ func (p *Peer) StoreForChannel(cid string) transientstore.Store {
609
625
// call returns nil if channel cid has not been created.
610
626
func (p * Peer ) GetChannelConfig (cid string ) channelconfig.Resources {
611
627
if c := p .Channel (cid ); c != nil {
612
- return c .resources
628
+ return c .Resources ()
613
629
}
614
630
return nil
615
631
}
@@ -632,7 +648,7 @@ func (p *Peer) GetChannelsInfo() []*pb.ChannelInfo {
632
648
// Note that this call returns nil if channel cid has not been created.
633
649
func (p * Peer ) GetStableChannelConfig (cid string ) channelconfig.Resources {
634
650
if c := p .Channel (cid ); c != nil {
635
- return c .bundleSource .StableBundle ()
651
+ return c .BundleSource () .StableBundle ()
636
652
}
637
653
return nil
638
654
}
@@ -641,7 +657,7 @@ func (p *Peer) GetStableChannelConfig(cid string) channelconfig.Resources {
641
657
// Note that this call returns nil if channel cid has not been created.
642
658
func (p * Peer ) GetCurrConfigBlock (cid string ) * common.Block {
643
659
if c := p .Channel (cid ); c != nil {
644
- return c .cb
660
+ return c .ConfigBlock ()
645
661
}
646
662
return nil
647
663
}
@@ -650,7 +666,7 @@ func (p *Peer) GetCurrConfigBlock(cid string) *common.Block {
650
666
// call returns nil if channel cid has not been created.
651
667
func (p * Peer ) GetLedger (cid string ) ledger.PeerLedger {
652
668
if c := p .Channel (cid ); c != nil {
653
- return c .ledger
669
+ return c .Ledger ()
654
670
}
655
671
return nil
656
672
}
@@ -667,7 +683,7 @@ func (p *Peer) GetMSPIDs(cid string) []string {
667
683
// call returns nil if channel cid has not been created.
668
684
func (p * Peer ) GetPolicyManager (cid string ) policies.Manager {
669
685
if c := p .Channel (cid ); c != nil {
670
- return c .resources .PolicyManager ()
686
+ return c .Resources () .PolicyManager ()
671
687
}
672
688
return nil
673
689
}
0 commit comments