From c94c799347a0a9e6803d5a6f224d37c8a90f533c Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Thu, 20 Jul 2017 13:28:31 +0300 Subject: [PATCH] re-read only when blockchain is changed --- secret_store/src/acl_storage.rs | 6 ++++-- secret_store/src/key_server_set.rs | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/secret_store/src/acl_storage.rs b/secret_store/src/acl_storage.rs index 7ae72cbfc..37d5bcd25 100644 --- a/secret_store/src/acl_storage.rs +++ b/secret_store/src/acl_storage.rs @@ -64,8 +64,10 @@ impl AclStorage for OnChainAclStorage { } impl ChainNotify for OnChainAclStorage { - fn new_blocks(&self, _imported: Vec, _invalid: Vec, _enacted: Vec, _retracted: Vec, _sealed: Vec, _proposed: Vec, _duration: u64) { - self.contract.lock().update() + fn new_blocks(&self, _imported: Vec, _invalid: Vec, enacted: Vec, retracted: Vec, _sealed: Vec, _proposed: Vec, _duration: u64) { + if !enacted.is_empty() || !retracted.is_empty() { + self.contract.lock().update() + } } } diff --git a/secret_store/src/key_server_set.rs b/secret_store/src/key_server_set.rs index 302f76196..47f033db1 100644 --- a/secret_store/src/key_server_set.rs +++ b/secret_store/src/key_server_set.rs @@ -85,7 +85,9 @@ impl KeyServerSet for OnChainKeyServerSet { impl ChainNotify for OnChainKeyServerSet { fn new_blocks(&self, _imported: Vec, _invalid: Vec, enacted: Vec, retracted: Vec, _sealed: Vec, _proposed: Vec, _duration: u64) { - self.contract.lock().update(enacted, retracted) + if !enacted.is_empty() || !retracted.is_empty() { + self.contract.lock().update(enacted, retracted) + } } }