From 0953e79cb046a214afd3175acabff46acfd7ac9a Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Tue, 14 Jun 2011 12:49:19 +0000 Subject: [PATCH] Improve the documentation for the PingService. Patch by Gary Rowe. --- .../google/bitcoin/examples/PingService.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/com/google/bitcoin/examples/PingService.java b/src/com/google/bitcoin/examples/PingService.java index cf06daa3..170f238c 100644 --- a/src/com/google/bitcoin/examples/PingService.java +++ b/src/com/google/bitcoin/examples/PingService.java @@ -26,8 +26,23 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; /** + *

* PingService demonstrates basic usage of the library. It sits on the network and when it receives coins, simply * sends them right back to the previous owner, determined rather arbitrarily by the address of the first input. + *

+ *

+ * If running on TestNet (slow but better than using real coins on prodnet) do the following: + *

    + *
  1. Backup your current wallet.dat in case of unforeseen problems
  2. + *
  3. Start your bitcoin client in test mode bitcoin -testnet. This will create a new sub-directory called testnet and should not interfere with normal wallets or operations.
  4. + *
  5. (Optional) Choose a fresh address
  6. + *
  7. (Optional) Visit the Testnet faucet (https://testnet.freebitcoins.appspot.com/) to load your client with test coins
  8. + *
  9. Run PingService -testnet
  10. + *
  11. Wait for the block chain to download
  12. + *
  13. Send some coins from your bitcoin client to the address provided in the PingService console
  14. + *
  15. Leave it running until you get the coins back again
  16. + *
+ *

*/ public class PingService { public static void main(String[] args) throws Exception { @@ -95,8 +110,8 @@ public class PingService { System.out.println("Downloading block chain. " + (max > 1000 ? "This may take a while." : "")); long current = max; while (current > 0) { - double pct = 100.0 - (100.0 * (current / (double)max)); - System.out.println(String.format("Chain download %d%% done", (int)pct)); + double pct = 100.0 - (100.0 * (current / (double) max)); + System.out.println(String.format("Chain download %d%% done", (int) pct)); progress.await(1, TimeUnit.SECONDS); current = progress.getCount(); }