sweep+contractcourt: track best height in UtxoSweeper

Thus we can use shorter method signatures. In doing so we also remove an
old TODO in one use case of `CreateSweepTx`.
This commit is contained in:
yyforyongyu
2023-10-24 07:14:55 +08:00
parent ca0813b1bf
commit 84a6fdcda3
5 changed files with 39 additions and 49 deletions

View File

@@ -140,8 +140,8 @@ func (s *mockSweeper) SweepInput(input input.Input, params sweep.Params) (
return result, nil
}
func (s *mockSweeper) CreateSweepTx(inputs []input.Input, feePref sweep.FeePreference,
currentBlockHeight uint32) (*wire.MsgTx, error) {
func (s *mockSweeper) CreateSweepTx(inputs []input.Input,
feePref sweep.FeePreference) (*wire.MsgTx, error) {
// We will wait for the test to supply the sweep tx to return.
sweepTx := <-s.createSweepTxChan

View File

@@ -432,17 +432,13 @@ func (h *htlcSuccessResolver) resolveRemoteCommitOutput() (
// transaction, that we'll use to move these coins back into
// the backing wallet.
//
// TODO: Set tx lock time to current block height instead of
// zero. Will be taken care of once sweeper implementation is
// complete.
//
// TODO: Use time-based sweeper and result chan.
var err error
h.sweepTx, err = h.Sweeper.CreateSweepTx(
[]input.Input{inp},
sweep.FeePreference{
ConfTarget: sweepConfTarget,
}, 0,
},
)
if err != nil {
return nil, err

View File

@@ -53,8 +53,8 @@ type UtxoSweeper interface {
// CreateSweepTx accepts a list of inputs and signs and generates a txn
// that spends from them. This method also makes an accurate fee
// estimate before generating the required witnesses.
CreateSweepTx(inputs []input.Input, feePref sweep.FeePreference,
currentBlockHeight uint32) (*wire.MsgTx, error)
CreateSweepTx(inputs []input.Input,
feePref sweep.FeePreference) (*wire.MsgTx, error)
// RelayFeePerKW returns the minimum fee rate required for transactions
// to be relayed.