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.
This commit is contained in:
Olaoluwa Osuntokun 2017-01-22 14:21:52 -08:00
parent dd42fa2f70
commit 8fd4d7ea6b
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -593,7 +593,7 @@ func (r *ChannelRouter) processNetworkAnnouncement(msg lnwire.Message) bool {
FeeProportionalMillionths: btcutil.Amount(msg.FeeProportionalMillionths), FeeProportionalMillionths: btcutil.Amount(msg.FeeProportionalMillionths),
// TODO(roasbeef): this is a hack, needs to be removed // TODO(roasbeef): this is a hack, needs to be removed
// after commitment fees are dynamic. // 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) err = r.cfg.Graph.UpdateEdgeInfo(chanUpdate)