From 15b42b89db5bd9488738ce33d35d96f8974a13cf Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 31 Aug 2016 17:19:41 +0930 Subject: [PATCH] peer: fix comparison bug if our connection_fee is negative. Signed-off-by: Rusty Russell --- daemon/peer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/peer.c b/daemon/peer.c index 7b5d17c5e..da14a13e0 100644 --- a/daemon/peer.c +++ b/daemon/peer.c @@ -457,7 +457,8 @@ static void route_htlc_onwards(struct peer *peer, return; /* Offered fee must be sufficient. */ - if (htlc->msatoshis - msatoshis < connection_fee(next->nc, msatoshis)) { + if ((s64)(htlc->msatoshis - msatoshis) + < connection_fee(next->nc, msatoshis)) { log_unusual(peer->log, "Insufficient fee for HTLC %"PRIu64 ": %"PRIi64" on %"PRIu64,