contractcourt+sweep: offer direct-preimage spend via SweepInput

This commit removes the method `CreateSweepTx` and makes sure when
sweeping the htlc output via the direct-preimage spend, it's offered via
the `SweepInput` interface.
This commit is contained in:
yyforyongyu
2024-03-19 12:32:01 +08:00
parent 9c1e6941c3
commit dc7d90c16f
6 changed files with 56 additions and 155 deletions

View File

@@ -181,17 +181,14 @@ func TestHtlcSuccessSingleStage(t *testing.T) {
// that our sweep succeeded.
preCheckpoint: func(ctx *htlcResolverTestContext,
_ bool) error {
// The resolver will create and publish a sweep
// tx.
resolver := ctx.resolver.(*htlcSuccessResolver)
resolver.Sweeper.(*mockSweeper).
createSweepTxChan <- sweepTx
// Confirm the sweep, which should resolve it.
ctx.notifier.ConfChan <- &chainntnfs.TxConfirmation{
Tx: sweepTx,
BlockHeight: testInitialBlockHeight - 1,
// The resolver will offer the input to the
// sweeper.
details := &chainntnfs.SpendDetail{
SpendingTx: sweepTx,
SpenderTxHash: &sweepTxid,
}
ctx.notifier.SpendChan <- details
return nil
},