mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 21:47:18 +00:00
Coin.toFriendlyFormat() includes denomination (BTC). This saves a lot of string concatenation code.
This commit is contained in:
committed by
Mike Hearn
parent
794263436f
commit
afcc7e3f13
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user