contractcourt: update GenSweepScript to return internal key

For the upcoming aux sweeper integration, the internal key is needed for
the call backs.
This commit is contained in:
Olaoluwa Osuntokun
2024-06-23 23:30:52 -07:00
parent 9a181105e2
commit f81cd79bca
3 changed files with 19 additions and 22 deletions

View File

@@ -149,7 +149,7 @@ type BreachConfig struct {
Estimator chainfee.Estimator
// GenSweepScript generates the receiving scripts for swept outputs.
GenSweepScript func() ([]byte, error)
GenSweepScript func() fn.Result[lnwallet.AddrWithKey]
// Notifier provides a publish/subscribe interface for event driven
// notifications regarding the confirmation of txids.
@@ -1517,7 +1517,7 @@ func (b *BreachArbitrator) sweepSpendableOutputsTxn(txWeight lntypes.WeightUnit,
// sweep the funds to.
// TODO(roasbeef): possibly create many outputs to minimize change in
// the future?
pkScript, err := b.cfg.GenSweepScript()
pkScript, err := b.cfg.GenSweepScript().Unpack()
if err != nil {
return nil, err
}
@@ -1545,7 +1545,7 @@ func (b *BreachArbitrator) sweepSpendableOutputsTxn(txWeight lntypes.WeightUnit,
// We begin by adding the output to which our funds will be deposited.
txn.AddTxOut(&wire.TxOut{
PkScript: pkScript,
PkScript: pkScript.DeliveryAddress,
Value: sweepAmt,
})