re-read only when blockchain is changed

This commit is contained in:
Svyatoslav Nikolsky 2017-07-20 13:28:31 +03:00
parent b9ad093d06
commit c94c799347
2 changed files with 7 additions and 3 deletions

View File

@ -64,8 +64,10 @@ impl AclStorage for OnChainAclStorage {
} }
impl ChainNotify for OnChainAclStorage { impl ChainNotify for OnChainAclStorage {
fn new_blocks(&self, _imported: Vec<H256>, _invalid: Vec<H256>, _enacted: Vec<H256>, _retracted: Vec<H256>, _sealed: Vec<H256>, _proposed: Vec<Bytes>, _duration: u64) { fn new_blocks(&self, _imported: Vec<H256>, _invalid: Vec<H256>, enacted: Vec<H256>, retracted: Vec<H256>, _sealed: Vec<H256>, _proposed: Vec<Bytes>, _duration: u64) {
self.contract.lock().update() if !enacted.is_empty() || !retracted.is_empty() {
self.contract.lock().update()
}
} }
} }

View File

@ -85,7 +85,9 @@ impl KeyServerSet for OnChainKeyServerSet {
impl ChainNotify for OnChainKeyServerSet { impl ChainNotify for OnChainKeyServerSet {
fn new_blocks(&self, _imported: Vec<H256>, _invalid: Vec<H256>, enacted: Vec<H256>, retracted: Vec<H256>, _sealed: Vec<H256>, _proposed: Vec<Bytes>, _duration: u64) { fn new_blocks(&self, _imported: Vec<H256>, _invalid: Vec<H256>, enacted: Vec<H256>, retracted: Vec<H256>, _sealed: Vec<H256>, _proposed: Vec<Bytes>, _duration: u64) {
self.contract.lock().update(enacted, retracted) if !enacted.is_empty() || !retracted.is_empty() {
self.contract.lock().update(enacted, retracted)
}
} }
} }