diff --git a/server.go b/server.go index c6ae09b6..b4693f3d 100644 --- a/server.go +++ b/server.go @@ -636,7 +636,7 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl, Notifier: cc.chainNotifier, PublishTransaction: cc.wallet.PublishTransaction, Store: utxnStore, - Sweeper: s.sweeper, + SweepInput: s.sweeper.SweepInput, }) // Construct a closure that wraps the htlcswitch's CloseLink method. diff --git a/utxonursery.go b/utxonursery.go index 5285127e..f31ca496 100644 --- a/utxonursery.go +++ b/utxonursery.go @@ -195,9 +195,8 @@ type NurseryConfig struct { // maintained about the utxo nursery's incubating outputs. Store NurseryStore - // Sweeper provides functionality to generate sweep transactions. - // Nursery uses this to sweep final outputs back into the wallet. - Sweeper *sweep.UtxoSweeper + // Sweep sweeps an input back to the wallet. + SweepInput func(input sweep.Input) (chan sweep.Result, error) } // utxoNursery is a system dedicated to incubating time-locked outputs created @@ -803,7 +802,7 @@ func (u *utxoNursery) sweepMatureOutputs(classHeight uint32, // passed in with disastruous consequences. local := output - resultChan, err := u.cfg.Sweeper.SweepInput(&local) + resultChan, err := u.cfg.SweepInput(&local) if err != nil { return err } diff --git a/utxonursery_test.go b/utxonursery_test.go index 1584edb4..577d1c44 100644 --- a/utxonursery_test.go +++ b/utxonursery_test.go @@ -488,9 +488,9 @@ func createNurseryTestContext(t *testing.T, CloseHeight: 0, }, nil }, - Store: storeIntercepter, - ChainIO: chainIO, - Sweeper: sweeper, + Store: storeIntercepter, + ChainIO: chainIO, + SweepInput: sweeper.SweepInput, PublishTransaction: func(tx *wire.MsgTx) error { return publishFunc(tx, "nursery") }, @@ -556,7 +556,7 @@ func createNurseryTestContext(t *testing.T, } /// Restart nursery. - nurseryCfg.Sweeper = ctx.sweeper + nurseryCfg.SweepInput = ctx.sweeper.SweepInput ctx.nursery = newUtxoNursery(&nurseryCfg) ctx.nursery.Start()