Skip to content

Commit

Permalink
[FAB-6160] peer deliver refresh AC upon resource update
Browse files Browse the repository at this point in the history
When https://gerrit.hyperledger.org/r/#/c/16037/ is going to be merged,
the custom ACL is going to reside in the resource config.

The deliver service in the peer would need a way to re-evaluate clients
when a resource config has occurred.

The current code exposes a method to the support of the deliver service
that returns the sequence of the latest channel config.
The access control logic in the deliver service, caches this sequence,
and before sending out a block - it checks if the config has changed,
and if it did - re-evaluates the policies.

This change set, simply makes this sequence to be the sum
of both resource config sequences, and channel config sequences.

Since both sequences are monotonously increasing, the sum is also
monotonously increasing, and therefore we can present to the deliver
service access control logic the sum as the sequence, without
changing anything else.

Change-Id: Ib3cc04c51f21598027fb8eae68d04b027184f52f
Signed-off-by: yacovm <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Jan 10, 2018
1 parent ae54de2 commit 81af16e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/peer/peer.go
Expand Up @@ -146,7 +146,8 @@ func (cs *chainSupport) GetMSPIDs(cid string) []string {

// Sequence passes through to the underlying configtx.Validator
func (cs *chainSupport) Sequence() uint64 {
return cs.ConfigtxValidator().Sequence()
sb := cs.bundleSource.StableBundle()
return sb.ConfigtxValidator().Sequence() + sb.ChannelConfig().ConfigtxValidator().Sequence()
}
func (cs *chainSupport) Reader() blockledger.Reader {
return cs.fileLedger
Expand Down

0 comments on commit 81af16e

Please sign in to comment.