read registry_address from given block (#7866)
This commit is contained in:
committed by
Afri Schoedon
parent
a30de1b8d8
commit
1ca1fba8cf
@@ -94,7 +94,7 @@ impl CachedContract {
|
||||
|
||||
pub fn update(&mut self) {
|
||||
if let Some(client) = self.client.get() {
|
||||
match client.registry_address(ACL_CHECKER_CONTRACT_REGISTRY_NAME.to_owned()) {
|
||||
match client.registry_address(ACL_CHECKER_CONTRACT_REGISTRY_NAME.to_owned(), BlockId::Latest) {
|
||||
Some(new_contract_addr) if Some(new_contract_addr).as_ref() != self.contract_addr.as_ref() => {
|
||||
trace!(target: "secretstore", "Configuring for ACL checker contract from {}", new_contract_addr);
|
||||
self.contract_addr = Some(new_contract_addr);
|
||||
|
||||
@@ -325,7 +325,7 @@ impl CachedContract {
|
||||
|
||||
fn read_from_registry_if_required(&mut self, client: &Client, enacted: Vec<H256>, retracted: Vec<H256>) {
|
||||
// read new contract from registry
|
||||
let new_contract_addr = client.registry_address(KEY_SERVER_SET_CONTRACT_REGISTRY_NAME.to_owned());
|
||||
let new_contract_addr = client.registry_address(KEY_SERVER_SET_CONTRACT_REGISTRY_NAME.to_owned(), BlockId::Latest);
|
||||
|
||||
// new contract installed => read nodes set from the contract
|
||||
if self.contract_address.as_ref() != new_contract_addr.as_ref() {
|
||||
|
||||
@@ -96,7 +96,7 @@ impl OnChainServiceContract {
|
||||
/// Create new on-chain service contract.
|
||||
pub fn new(client: TrustedClient, address: ContractAddress, self_key_pair: Arc<NodeKeyPair>) -> Self {
|
||||
let contract_addr = match address {
|
||||
ContractAddress::Registry => client.get().and_then(|c| c.registry_address(SERVICE_CONTRACT_REGISTRY_NAME.to_owned())
|
||||
ContractAddress::Registry => client.get().and_then(|c| c.registry_address(SERVICE_CONTRACT_REGISTRY_NAME.to_owned(), BlockId::Latest)
|
||||
.map(|address| {
|
||||
trace!(target: "secretstore", "{}: installing service contract from address {}",
|
||||
self_key_pair.public(), address);
|
||||
@@ -130,7 +130,7 @@ impl ServiceContract for OnChainServiceContract {
|
||||
if let &ContractAddress::Registry = &self.address {
|
||||
if let Some(client) = self.client.get() {
|
||||
// update contract address from registry
|
||||
let service_contract_addr = client.registry_address(SERVICE_CONTRACT_REGISTRY_NAME.to_owned()).unwrap_or_default();
|
||||
let service_contract_addr = client.registry_address(SERVICE_CONTRACT_REGISTRY_NAME.to_owned(), BlockId::Latest).unwrap_or_default();
|
||||
if self.data.read().contract_address != service_contract_addr {
|
||||
trace!(target: "secretstore", "{}: installing service contract from address {}",
|
||||
self.self_key_pair.public(), service_contract_addr);
|
||||
|
||||
Reference in New Issue
Block a user