Skip to content

Commit

Permalink
prelim support for --seedNodes param. not working yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-da committed Jul 20, 2016
1 parent c392915 commit 89ab87d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion core/src/main/java/io/bitsquare/btc/WalletService.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,35 @@ public List<Message> getData(Peer peer, GetDataMessage m) {
// 1333 / (2800 + 1333) = 0.32 -> 32 % probability that a pub key is in our wallet
walletAppKit.setBloomFilterFalsePositiveRate(0.00005);

// only for test/debug.
log.error( "seedNodes: " + seedNodes.toString() );

// Pass custom seed nodes if set in options
if (seedNodes != null && !seedNodes.isEmpty()) {
//TODO Check how to pass seed nodes to the wallet kit. Probably via walletAppKit.setPeerNodes

// todo: this parsing should be more robust,
// give validation error if needed.
// also: it seems the peer nodes can be overridden in the case
// of regtest mode below. is that wanted?
String[] nodes = seedNodes.split(",");
List<PeerAddress> peerAddressList = new ArrayList<PeerAddress>();
for(String node : nodes) {
String[] parts = node.split(":");
if( parts.length == 2 ) {
// note: this will cause a DNS request if hostname used.
// fixme: DNS request should be routed over Tor.
// fixme: .onion hostnames will fail!
InetSocketAddress addr = new InetSocketAddress(parts[0], Integer.parseInt(parts[1]) );
peerAddressList.add( new PeerAddress( addr ));
}
}
if(peerAddressList.size() > 0) {
PeerAddress peerAddressListFixed[] = new PeerAddress[peerAddressList.size()];
walletAppKit.setPeerNodes(peerAddressList.toArray(peerAddressListFixed));

// only for test/debug.
log.error( "seedNodes parsed: " + peerAddressListFixed.toString() );
}
}

// We do not call walletAppKit.useTor() anymore because that would turn
Expand Down

0 comments on commit 89ab87d

Please sign in to comment.