lnwallet: replace hard-coded fees and adjust tests accordingly

This commit replaces the hard-coded 5000 satoshi fees with calls to the
FeeEstimator interface. This should provide a way to cleanly plug in
additional fee calculation algorithms in the future. This change
affected quite a few tests. When possible, the tests were changed to
assert amounts sent rather than balances so that fees wouldn't need to
be taken into account. There were several tests for which this wasn't
possible, so calls to the static fee calculator were made.
This commit is contained in:
bryanvu authored and Olaoluwa Osuntokun committed 2017-05-15 20:26:11 -07:00
1 parent abe2e502d5
commit 4ac7cc719f
8 files changed
+222 -242

No files matched your search

+2 -2
View File
@@ -367,7 +367,7 @@ func TestEdgeUpdateNotification(t *testing.T) {
}
// TODO(roasbeef): this is a hack, needs to be removed
// after commitment fees are dynamic.
if edgeUpdate.Capacity != chanValue-5000 {
if edgeUpdate.Capacity != chanValue {
t.Fatalf("capacity of edge doesn't match: "+
"expected %v, got %v", chanValue, edgeUpdate.Capacity)
}
@@ -682,7 +682,7 @@ func TestChannelCloseNotification(t *testing.T) {
}
// TODO(roasbeef): this is a hack, needs to be removed
// after commitment fees are dynamic.
if closedChan.Capacity != chanValue-5000 {
if closedChan.Capacity != chanValue {
t.Fatalf("capacity of closed channel doesn't match: "+
"expected %v, got %v", chanValue, closedChan.Capacity)
}
+1 -1
View File
@@ -622,7 +622,7 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error {
// TODO(roasbeef): this is a hack, needs to be removed
// after commitment fees are dynamic.
msg.Capacity = btcutil.Amount(chanUtxo.Value) - btcutil.Amount(5000)
msg.Capacity = btcutil.Amount(chanUtxo.Value)
msg.ChannelPoint = *fundingPoint
if err := r.cfg.Graph.AddChannelEdge(msg); err != nil {
return errors.Errorf("unable to add edge: %v", err)