ForwardingSevice: add an address parameter to forwardCoins()

This makes forwardCoins() a little more generically-useful and
simplifies the coming conversion to CompletableFuture.
This commit is contained in:
Sean Gilligan 2022-07-14 18:33:46 -07:00 committed by Andreas Schildbach
parent a06134cc18
commit ccba23bd29

View File

@ -133,7 +133,7 @@ public class ForwardingService {
tx.getConfidence().getDepthFuture(requiredConfirmations).whenComplete((result, t) -> {
if (result != null) {
System.out.println("Confirmation received.");
forwardCoins();
forwardCoins(forwardingAddress);
} else {
// This kind of future can't fail, just rethrow in case something weird happens.
throw new RuntimeException(t);
@ -154,7 +154,7 @@ public class ForwardingService {
return String.format("forwarding-service-%s", network.toString());
}
private void forwardCoins() {
private void forwardCoins(Address forwardingAddress) {
try {
// Now send the coins onwards.
SendRequest sendRequest = SendRequest.emptyWallet(forwardingAddress);