Coin.toFriendlyFormat() includes denomination (BTC). This saves a lot of string concatenation code.

This commit is contained in:
Andreas Schildbach
2014-07-05 17:10:55 +02:00
committed by Mike Hearn
parent 794263436f
commit afcc7e3f13
10 changed files with 25 additions and 26 deletions

View File

@@ -169,7 +169,7 @@ public class ExamplePaymentChannelClient {
ListenableFuture<Coin> balanceFuture = appKit.wallet().getBalanceFuture(amountPlusFee, Wallet.BalanceType.ESTIMATED);
if (!balanceFuture.isDone()) {
System.out.println("Please send " + amountPlusFee.toFriendlyString() +
" BTC to " + myKey.toAddress(params));
" to " + myKey.toAddress(params));
Futures.getUnchecked(balanceFuture);
}
}

View File

@@ -121,7 +121,7 @@ public class ForwardingService {
private static void forwardCoins(Transaction tx) {
try {
Coin value = tx.getValueSentToMe(kit.wallet());
System.out.println("Forwarding " + value.toFriendlyString() + " BTC");
System.out.println("Forwarding " + value.toFriendlyString());
// Now send the coins back! Send with a small fee attached to ensure rapid confirmation.
final Coin amountToSend = value.subtract(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE);
final Wallet.SendResult sendResult = kit.wallet().sendCoins(kit.peerGroup(), forwardingAddress, amountToSend);

View File

@@ -68,7 +68,7 @@ public class PrivateKeys {
peerGroup.stopAsync();
// And take them!
System.out.println("Claiming " + wallet.getBalance().toFriendlyString() + " coins");
System.out.println("Claiming " + wallet.getBalance().toFriendlyString());
wallet.sendCoins(peerGroup, destination, wallet.getBalance());
// Wait a few seconds to let the packets flush out to the network (ugly).
Thread.sleep(5000);