mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-25 07:10:48 -04:00
Refactor bootstrap node definitions
This commit is contained in:
parent
68a4178bf3
commit
19bb552224
14 changed files with 214 additions and 138 deletions
|
@ -117,7 +117,7 @@ public class BitsquareAppMain extends BitsquareExecutable {
|
|||
.ofType(boolean.class);
|
||||
parser.accepts(NAME_KEY, description("Name of this node", null))
|
||||
.withRequiredArg();
|
||||
parser.accepts(PORT_KEY, description("Port to listen on", Node.DEFAULT_PORT))
|
||||
parser.accepts(PORT_KEY, description("Port to listen on", Node.CLIENT_PORT))
|
||||
.withRequiredArg()
|
||||
.ofType(int.class);
|
||||
parser.accepts(USE_MANUAL_PORT_FORWARDING_KEY, description("Use manual port forwarding", false))
|
||||
|
@ -134,11 +134,14 @@ public class BitsquareAppMain extends BitsquareExecutable {
|
|||
.withValuesConvertedBy(new EnumValueConverter(RegTestHost.class));
|
||||
|
||||
|
||||
parser.accepts(BOOTSTRAP_NODE_NAME_KEY, description("", BootstrapNodes.getSelectedNode().getName()))
|
||||
parser.accepts(BOOTSTRAP_NODE_NAME_KEY, description("Bootstrap node name", BootstrapNodes.getLocalhostNode().getName()))
|
||||
.withRequiredArg();
|
||||
parser.accepts(BOOTSTRAP_NODE_IP_KEY, description("", BootstrapNodes.getSelectedNode().getIp()))
|
||||
parser.accepts(BOOTSTRAP_NODE_IP_KEY, description("Bootstrap node IP", BootstrapNodes.getLocalhostNode().getIp()))
|
||||
.withRequiredArg();
|
||||
parser.accepts(BOOTSTRAP_NODE_PORT_KEY, description("", BootstrapNodes.getSelectedNode().getPort()))
|
||||
parser.accepts(BOOTSTRAP_NODE_P2P_ID_KEY, description("Bootstrap node p2p network ID", BootstrapNodes.getLocalhostNode().getPort()))
|
||||
.withRequiredArg()
|
||||
.ofType(int.class);
|
||||
parser.accepts(BOOTSTRAP_NODE_PORT_KEY, description("Bootstrap node port", BootstrapNodes.getLocalhostNode().getPort()))
|
||||
.withRequiredArg()
|
||||
.ofType(int.class);
|
||||
parser.accepts(NETWORK_INTERFACE_KEY, description("Network interface", null))
|
||||
|
|
|
@ -77,7 +77,7 @@ class MainViewModel implements ViewModel {
|
|||
private final OpenOfferManager openOfferManager;
|
||||
private final UpdateProcess updateProcess;
|
||||
private final BSFormatter formatter;
|
||||
private final int networkId;
|
||||
private final int p2pId;
|
||||
|
||||
// BTC network
|
||||
final StringProperty blockchainSyncInfo = new SimpleStringProperty("Initializing");
|
||||
|
@ -132,7 +132,7 @@ class MainViewModel implements ViewModel {
|
|||
this.formatter = formatter;
|
||||
|
||||
bitcoinNetworkAsString = formatter.formatBitcoinNetwork(preferences.getBitcoinNetwork());
|
||||
networkId = preferences.getBitcoinNetwork().ordinal();
|
||||
p2pId = preferences.getBitcoinNetwork().ordinal() + 10; // p2pId: Mainnet 10, testnet 11, regtest 12
|
||||
|
||||
updateProcess.state.addListener((observableValue, oldValue, newValue) -> applyUpdateState(newValue));
|
||||
applyUpdateState(updateProcess.state.get());
|
||||
|
@ -206,7 +206,7 @@ class MainViewModel implements ViewModel {
|
|||
});
|
||||
|
||||
clientNode.setExecutor(Platform::runLater);
|
||||
Observable<BootstrappedPeerBuilder.State> bootstrapStateAsObservable = clientNode.bootstrap(networkId, keyRing.getDhtSignatureKeyPair());
|
||||
Observable<BootstrappedPeerBuilder.State> bootstrapStateAsObservable = clientNode.bootstrap(p2pId, keyRing.getDhtSignatureKeyPair());
|
||||
bootstrapStateAsObservable.publish();
|
||||
bootstrapStateAsObservable.subscribe(
|
||||
state -> Platform.runLater(() -> setBootstrapState(state)),
|
||||
|
|
|
@ -71,8 +71,8 @@ public class NetworkSettingsView extends InitializableView {
|
|||
|
||||
connectionType.setText(clientNode.getConnectionType().toString());
|
||||
connectedPeersP2P.textProperty().bind(createStringBinding(() -> String.valueOf(clientNode.numPeersProperty().get()), clientNode.numPeersProperty()));
|
||||
nodeAddress.setText(clientNode.getAddress().toString());
|
||||
bootstrapNodeAddress.setText(clientNode.getBootstrapNodeAddress().toString());
|
||||
nodeAddress.setText(clientNode.getClientNodeInfo());
|
||||
bootstrapNodeAddress.setText(clientNode.getBootstrapNode().toString());
|
||||
|
||||
useUPnP.setSelected(preferences.getUseUPnP());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue