Skip to content

Commit

Permalink
Add an overload of makeRegistryClient that uses the config value
Browse files Browse the repository at this point in the history
So we don't have to pass it to agora.node.Registry just so it can pass it back.
  • Loading branch information
Geod24 committed Feb 11, 2022
1 parent 3cf2d15 commit 4ae6db2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions source/agora/network/Manager.d
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,7 @@ public class NetworkManager
enforce(this.config.node.registry_address.set,
"A validator should have a name registry configured");

this.registry_client = this.makeRegistryClient(
this.config.node.registry_address);
this.registry_client = this.makeRegistryClient();

this.onRegisterName(); // avoid delay
// We re-register at regular interval in order to cope with the situation below
Expand Down Expand Up @@ -1030,6 +1029,11 @@ public class NetworkManager
Instantiates a client object implementing `NameRegistryAPI`
The parameter-less overload uses the address configured in the
configuration file, or `null` if there is none, while the overload
taking an `Address` will connect to an arbitrary registry and will
always return a non-`null` value.
Params:
address = The address of the name registry server
Expand All @@ -1040,6 +1044,14 @@ public class NetworkManager

public abstract NameRegistryAPI makeRegistryClient (Address address);

/// Ditto
public final NameRegistryAPI makeRegistryClient ()
{
if (!this.config.node.registry_address.set)
return null;
return this.makeRegistryClient(this.config.node.registry_address);
}

/***************************************************************************
Gossips the ValidatorBlockSig to the network of connected validators.
Expand Down

0 comments on commit 4ae6db2

Please sign in to comment.