Add btc peers to list in UI

This commit is contained in:
Manfred Karrer 2015-12-31 18:19:33 +01:00
parent 67fb7aa825
commit 16baa3ec8d
7 changed files with 69 additions and 40 deletions

View file

@ -31,7 +31,7 @@ public final class Arbitrator implements PubKeyProtectedExpirablePayload {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
public static final long TTL = 10 * 24 * 60 * 60 * 1000; // 10 days
public static final long TTL = 1 * 24 * 60 * 60 * 1000; // 1 day
// Persisted fields
private final byte[] btcPubKey;

View file

@ -89,6 +89,7 @@ public class WalletService {
private Wallet wallet;
private AddressEntry arbitratorAddressEntry;
private final IntegerProperty numPeers = new SimpleIntegerProperty(0);
private final ObjectProperty<List<Peer>> connectedPeers = new SimpleObjectProperty<>();
public final BooleanProperty shutDownDone = new SimpleBooleanProperty();
@ -107,7 +108,7 @@ public class WalletService {
// TODO remove after sufficient testing with testnet
checkArgument(!params.getId().equals(NetworkParameters.ID_MAINNET),
"Mainnet is not allowed to be used at that stage of development");
this.walletDir = new File(walletDir, "bitcoin");
this.userAgent = userAgent;
}
@ -165,11 +166,13 @@ public class WalletService {
@Override
public void onPeerConnected(Peer peer, int peerCount) {
numPeers.set(peerCount);
connectedPeers.set(walletAppKit.peerGroup().getConnectedPeers());
}
@Override
public void onPeerDisconnected(Peer peer, int peerCount) {
numPeers.set(peerCount);
connectedPeers.set(walletAppKit.peerGroup().getConnectedPeers());
}
@Override
@ -506,6 +509,10 @@ public class WalletService {
return numPeers;
}
public ReadOnlyObjectProperty<List<Peer>> connectedPeersProperty() {
return connectedPeers;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods

View file

@ -48,20 +48,18 @@ public class Preferences implements Serializable {
// Deactivate mBit for now as most screens are not supporting it yet
transient private static final List<String> BTC_DENOMINATIONS = Arrays.asList(MonetaryFormat.CODE_BTC/*, MonetaryFormat.CODE_MBTC*/);
transient static final private ArrayList<BlockChainExplorer> blockChainExplorersTestNet = new ArrayList<>(Arrays.asList(
new BlockChainExplorer("Biteasy", "https://www.biteasy.com/testnet/transactions/", "https://www.biteasy.com/testnet/addresses/"),
new BlockChainExplorer("Blocktrail", "https://www.blocktrail.com/tBTC/tx/", "https://www.blocktrail.com/tBTC/address/"),
new BlockChainExplorer("Blockr.io", "https://tbtc.blockr.io/tx/info/", "https://tbtc.blockr.io/address/info/"),
new BlockChainExplorer("Web BTC", "http://test.webbtc.com/tx/", "http://test.webbtc.com/address/"),
new BlockChainExplorer("Blockexplorer", "https://blockexplorer.com/testnet/tx/", "https://blockexplorer.com/testnet/address/"),
new BlockChainExplorer("Biteasy", "https://www.biteasy.com/testnet/transactions/", "https://www.biteasy.com/testnet/addresses/")
new BlockChainExplorer("Blockexplorer", "https://blockexplorer.com/testnet/tx/", "https://blockexplorer.com/testnet/address/")
));
transient static final private ArrayList<BlockChainExplorer> blockChainExplorersMainNet = new ArrayList<>(Arrays.asList(
new BlockChainExplorer("Biteasy", "https://www.biteasy.com/transactions/", "https://www.biteasy.com/addresses/"),
new BlockChainExplorer("Blockchain.info", "https://blockchain.info/tx/", "https://blockchain.info/address/"),
new BlockChainExplorer("Blocktrail", "https://www.blocktrail.com/BTC/tx/", "https://www.blocktrail.com/BTC/address/"),
new BlockChainExplorer("Blockr.io", "https://btc.blockr.io/tx/info/", "https://btc.blockr.io/address/info/"),
new BlockChainExplorer("Web BTC", "http://webbtc.com/tx/", "http://webbtc.com/address/"),
new BlockChainExplorer("Blockexplorer", "https://blockexplorer.com/tx/", "https://blockexplorer.com/address/"),
new BlockChainExplorer("Biteasy", "https://www.biteasy.com/transactions/", "https://www.biteasy.com/addresses/")
new BlockChainExplorer("Blockexplorer", "https://blockexplorer.com/tx/", "https://blockexplorer.com/address/")
));
public static List<String> getBtcDenominations() {