From 8fd4d7ea6b3d7a546101815c038d42540cf7833c Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 22 Jan 2017 14:21:52 -0800 Subject: [PATCH] routing: fix bug in channel capacity display by ensuring properly typed arithmetic This commit fixes a slight bug in the storage of the capacity of a channel. Previously, we were subtracting a the hard coded fee amount without first casting the integer to a btcutil.Amount which results in a display/rounding error when the amount is converted to BTC. --- routing/router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing/router.go b/routing/router.go index bcccc51d..44de872d 100644 --- a/routing/router.go +++ b/routing/router.go @@ -593,7 +593,7 @@ func (r *ChannelRouter) processNetworkAnnouncement(msg lnwire.Message) bool { FeeProportionalMillionths: btcutil.Amount(msg.FeeProportionalMillionths), // TODO(roasbeef): this is a hack, needs to be removed // after commitment fees are dynamic. - Capacity: btcutil.Amount(utxo.Value) - 5000, + Capacity: btcutil.Amount(utxo.Value) - btcutil.Amount(5000), } err = r.cfg.Graph.UpdateEdgeInfo(chanUpdate)