@@ -70,6 +70,7 @@ type testCase struct {
7070 name string
7171 test func (t * harnessTest )
7272 proofCourierType proof.CourierType
73+ tapdOptions []Option
7374}
7475
7576// harnessTest wraps a regular testing.T providing enhanced error detection
@@ -270,7 +271,7 @@ func (h *harnessTest) addFederationServer(host string, target *tapdHarness) {
270271// to each other through an in-memory gRPC connection.
271272func setupHarnesses (t * testing.T , ht * harnessTest ,
272273 lndHarness * lntest.HarnessTest , uniServerLndHarness * node.HarnessNode ,
273- proofCourierType proof.CourierType ) (* tapdHarness ,
274+ proofCourierType proof.CourierType , tapdOpts ... Option ) (* tapdHarness ,
274275 * universeServerHarness , proof.CourierHarness ) {
275276
276277 // Create a new universe server harness and start it.
@@ -306,10 +307,11 @@ func setupHarnesses(t *testing.T, ht *harnessTest,
306307 alice := lndHarness .NewNodeWithCoins ("Alice" , nil )
307308
308309 // Create a tapd that uses Alice and connect it to the universe server.
310+ tapdOptions := append (tapdOpts , func (params * tapdHarnessParams ) {
311+ params .proofCourier = proofCourier
312+ })
309313 tapdHarness := setupTapdHarness (
310- t , ht , alice , universeServer , func (params * tapdHarnessParams ) {
311- params .proofCourier = proofCourier
312- },
314+ t , ht , alice , universeServer , tapdOptions ... ,
313315 )
314316 return tapdHarness , universeServer , proofCourier
315317}
@@ -372,6 +374,10 @@ type tapdHarnessParams struct {
372374 // sendPriceHint indicates whether the tapd should send price hints from
373375 // the local oracle to the counterparty when requesting a quote.
374376 sendPriceHint bool
377+
378+ // sweepOrphanUtxos indicates whether orphaned UTXOs should be swept
379+ // into anchor transactions.
380+ sweepOrphanUtxos bool
375381}
376382
377383// Option is a tapd harness option.
@@ -400,6 +406,14 @@ func WithSendPriceHint() Option {
400406 }
401407}
402408
409+ // WithSweepOrphanUtxos enables sweeping zero-value anchor UTXOs for
410+ // the tapd harness created with this option.
411+ func WithSweepOrphanUtxos () Option {
412+ return func (th * tapdHarnessParams ) {
413+ th .sweepOrphanUtxos = true
414+ }
415+ }
416+
403417// setupTapdHarness creates a new tapd that connects to the given lnd node
404418// and to the given universe server.
405419func setupTapdHarness (t * testing.T , ht * harnessTest ,
@@ -434,6 +448,7 @@ func setupTapdHarness(t *testing.T, ht *harnessTest,
434448 ho .disableSyncCache = params .disableSyncCache
435449 ho .oracleServerAddress = params .oracleServerAddress
436450 ho .sendPriceHint = params .sendPriceHint
451+ ho .sweepOrphanUtxos = params .sweepOrphanUtxos
437452 }
438453
439454 tapdCfg := tapdConfig {
0 commit comments