From 81af16eadbd31fb44678ee12a3da49cc69e20d27 Mon Sep 17 00:00:00 2001 From: yacovm Date: Mon, 8 Jan 2018 23:19:48 +0200 Subject: [PATCH] [FAB-6160] peer deliver refresh AC upon resource update 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 --- core/peer/peer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/peer/peer.go b/core/peer/peer.go index 48558c16aa7..de8bc248cd2 100644 --- a/core/peer/peer.go +++ b/core/peer/peer.go @@ -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