cnct+sweeper: give contract court access to relay fee

Relay fee is needed later to sweep anchors at the minimum fee rate.
This commit is contained in:
Joost Jager 2020-03-11 08:52:20 +01:00
parent c376cdb733
commit 3b517390d8
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
3 changed files with 16 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/lightningnetwork/lnd/sweep"
)
@ -120,6 +121,10 @@ func (s *mockSweeper) CreateSweepTx(inputs []input.Input, feePref sweep.FeePrefe
return nil, nil
}
func (s *mockSweeper) RelayFeePerKW() chainfee.SatPerKWeight {
return 253
}
var _ UtxoSweeper = &mockSweeper{}
// TestCommitSweepResolverNoDelay tests resolution of a direct commitment output

View File

@ -9,6 +9,7 @@ import (
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/invoices"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/sweep"
)
@ -51,4 +52,8 @@ type UtxoSweeper interface {
// estimate before generating the required witnesses.
CreateSweepTx(inputs []input.Input, feePref sweep.FeePreference,
currentBlockHeight uint32) (*wire.MsgTx, error)
// RelayFeePerKW returns the minimum fee rate required for transactions
// to be relayed.
RelayFeePerKW() chainfee.SatPerKWeight
}

View File

@ -384,6 +384,12 @@ func (s *UtxoSweeper) Start() error {
return nil
}
// RelayFeePerKW returns the minimum fee rate required for transactions to be
// relayed.
func (s *UtxoSweeper) RelayFeePerKW() chainfee.SatPerKWeight {
return s.relayFeeRate
}
// Stop stops sweeper from listening to block epochs and constructing sweep
// txes.
func (s *UtxoSweeper) Stop() error {