Clarify concept of 'default network' in BitcoinModule

This commit is contained in:
Chris Beams 2014-11-06 08:53:38 +01:00
parent c7524edef3
commit 1ea30fb4ae
No known key found for this signature in database
GPG key ID: 3D214F8F5BC5ED73

View file

@ -30,15 +30,17 @@ import java.util.Properties;
public class BitcoinModule extends AbstractBitsquareModule { public class BitcoinModule extends AbstractBitsquareModule {
private final BitcoinNetwork defaultNetwork; private static final BitcoinNetwork DEFAULT_NETWORK = BitcoinNetwork.REGTEST;
private final BitcoinNetwork network;
public BitcoinModule(Properties properties) { public BitcoinModule(Properties properties) {
this(properties, BitcoinNetwork.REGTEST); this(properties, DEFAULT_NETWORK);
} }
public BitcoinModule(Properties properties, BitcoinNetwork defaultNetwork) { public BitcoinModule(Properties properties, BitcoinNetwork network) {
super(properties); super(properties);
this.defaultNetwork = defaultNetwork; this.network = network;
} }
@Override @Override
@ -55,7 +57,7 @@ public class BitcoinModule extends AbstractBitsquareModule {
} }
private NetworkParameters network() { private NetworkParameters network() {
String networkName = properties.getProperty("networkType", defaultNetwork.name()); String networkName = properties.getProperty("networkType", network.name());
switch (BitcoinNetwork.valueOf(networkName.toUpperCase())) { switch (BitcoinNetwork.valueOf(networkName.toUpperCase())) {
case MAINNET: case MAINNET: