diff --git a/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServerState.java b/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServerState.java index 28eafb85..68e01485 100644 --- a/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServerState.java +++ b/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServerState.java @@ -396,6 +396,7 @@ public class PaymentChannelServerState { if (!wallet.completeTx(req)) // Let wallet handle adding additional inputs/fee as necessary. throw new ValueOutOfRangeException("Unable to complete transaction - unable to pay required fee"); feePaidForPayment = req.fee; + log.info("Calculated fee is {}", feePaidForPayment); if (feePaidForPayment.compareTo(bestValueToMe) >= 0) throw new ValueOutOfRangeException(String.format("Had to pay more in fees (%s) than the channel was worth (%s)", feePaidForPayment, bestValueToMe)); diff --git a/core/src/test/java/com/google/bitcoin/protocols/channels/PaymentChannelStateTest.java b/core/src/test/java/com/google/bitcoin/protocols/channels/PaymentChannelStateTest.java index ff9acfe2..e163b83b 100644 --- a/core/src/test/java/com/google/bitcoin/protocols/channels/PaymentChannelStateTest.java +++ b/core/src/test/java/com/google/bitcoin/protocols/channels/PaymentChannelStateTest.java @@ -650,7 +650,12 @@ public class PaymentChannelStateTest extends TestWithWallet { serverState = new PaymentChannelServerState(mockBroadcaster, serverWallet, serverKey, EXPIRE_TIME); assertEquals(PaymentChannelServerState.State.WAITING_FOR_REFUND_TRANSACTION, serverState.getState()); - clientState = new PaymentChannelClientState(wallet, myKey, new ECKey(null, serverKey.getPubKey()), Utils.CENT, EXPIRE_TIME); + clientState = new PaymentChannelClientState(wallet, myKey, new ECKey(null, serverKey.getPubKey()), Utils.CENT, EXPIRE_TIME) { + @Override + protected void editContractSendRequest(Wallet.SendRequest req) { + req.coinSelector = wallet.getCoinSelector(); + } + }; assertEquals(PaymentChannelClientState.State.NEW, clientState.getState()); clientState.initiate(); assertEquals(PaymentChannelClientState.State.INITIATED, clientState.getState()); @@ -705,7 +710,7 @@ public class PaymentChannelStateTest extends TestWithWallet { serverState.close(); fail(); } catch (ValueOutOfRangeException e) { - assertTrue(e.getMessage().contains("more in fees than the channel was worth")); + assertTrue(e.getMessage().contains("more in fees")); } signature = clientState.incrementPaymentBy(BigInteger.ONE.shiftLeft(1));