Skip to content

Commit

Permalink
Allowing settlement of unused channel
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberzac authored and mikehearn committed Sep 4, 2015
1 parent fc9ae41 commit 7c8c2a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public synchronized ListenableFuture<Transaction> close() throws InsufficientMon
wallet.completeTx(req); // TODO: Fix things so shuffling is usable.
feePaidForPayment = req.tx.getFee();
log.info("Calculated fee is {}", feePaidForPayment);
if (feePaidForPayment.compareTo(bestValueToMe) >= 0) {
if (feePaidForPayment.compareTo(bestValueToMe) > 0) {
final String msg = String.format("Had to pay more in fees (%s) than the channel was worth (%s)",
feePaidForPayment, bestValueToMe);
throw new InsufficientMoneyException(feePaidForPayment.subtract(bestValueToMe), msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,8 @@ protected void editContractSendRequest(Wallet.SendRequest req) {
assertTrue(e.getMessage().contains("more in fees"));
}

signature = clientState.incrementPaymentBy(SATOSHI.multiply(2), null).signature.encodeToBitcoin();
totalRefund = totalRefund.subtract(SATOSHI.multiply(2));
signature = clientState.incrementPaymentBy(SATOSHI, null).signature.encodeToBitcoin();
totalRefund = totalRefund.subtract(SATOSHI);
serverState.incrementPayment(totalRefund, signature);

// And settle the channel.
Expand Down

0 comments on commit 7c8c2a4

Please sign in to comment.