mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-28 13:52:55 +02:00
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:
@@ -149,7 +149,7 @@ type BreachConfig struct {
|
|||||||
Estimator chainfee.Estimator
|
Estimator chainfee.Estimator
|
||||||
|
|
||||||
// GenSweepScript generates the receiving scripts for swept outputs.
|
// 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
|
// Notifier provides a publish/subscribe interface for event driven
|
||||||
// notifications regarding the confirmation of txids.
|
// notifications regarding the confirmation of txids.
|
||||||
@@ -1517,7 +1517,7 @@ func (b *BreachArbitrator) sweepSpendableOutputsTxn(txWeight lntypes.WeightUnit,
|
|||||||
// sweep the funds to.
|
// sweep the funds to.
|
||||||
// TODO(roasbeef): possibly create many outputs to minimize change in
|
// TODO(roasbeef): possibly create many outputs to minimize change in
|
||||||
// the future?
|
// the future?
|
||||||
pkScript, err := b.cfg.GenSweepScript()
|
pkScript, err := b.cfg.GenSweepScript().Unpack()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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.
|
// We begin by adding the output to which our funds will be deposited.
|
||||||
txn.AddTxOut(&wire.TxOut{
|
txn.AddTxOut(&wire.TxOut{
|
||||||
PkScript: pkScript,
|
PkScript: pkScript.DeliveryAddress,
|
||||||
Value: sweepAmt,
|
Value: sweepAmt,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -2138,11 +2138,15 @@ func createTestArbiter(t *testing.T, contractBreaches chan *ContractBreachEvent,
|
|||||||
CloseLink: func(_ *wire.OutPoint, _ ChannelCloseType) {},
|
CloseLink: func(_ *wire.OutPoint, _ ChannelCloseType) {},
|
||||||
DB: db.ChannelStateDB(),
|
DB: db.ChannelStateDB(),
|
||||||
Estimator: chainfee.NewStaticEstimator(12500, 0),
|
Estimator: chainfee.NewStaticEstimator(12500, 0),
|
||||||
GenSweepScript: func() ([]byte, error) { return nil, nil },
|
GenSweepScript: func() fn.Result[lnwallet.AddrWithKey] {
|
||||||
|
return fn.Ok(lnwallet.AddrWithKey{})
|
||||||
|
},
|
||||||
ContractBreaches: contractBreaches,
|
ContractBreaches: contractBreaches,
|
||||||
Signer: signer,
|
Signer: signer,
|
||||||
Notifier: notifier,
|
Notifier: notifier,
|
||||||
PublishTransaction: func(_ *wire.MsgTx, _ string) error { return nil },
|
PublishTransaction: func(_ *wire.MsgTx, _ string) error {
|
||||||
|
return nil
|
||||||
|
},
|
||||||
Store: store,
|
Store: store,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
13
server.go
13
server.go
@@ -1177,16 +1177,9 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
CloseLink: closeLink,
|
CloseLink: closeLink,
|
||||||
DB: s.chanStateDB,
|
DB: s.chanStateDB,
|
||||||
Estimator: s.cc.FeeEstimator,
|
Estimator: s.cc.FeeEstimator,
|
||||||
GenSweepScript: func() ([]byte, error) {
|
GenSweepScript: newSweepPkScriptGen(
|
||||||
addr, err := newSweepPkScriptGen(
|
cc.Wallet, s.cfg.ActiveNetParams.Params,
|
||||||
cc.Wallet, netParams,
|
),
|
||||||
)().Unpack()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return addr.DeliveryAddress, nil
|
|
||||||
},
|
|
||||||
Notifier: cc.ChainNotifier,
|
Notifier: cc.ChainNotifier,
|
||||||
PublishTransaction: cc.Wallet.PublishTransaction,
|
PublishTransaction: cc.Wallet.PublishTransaction,
|
||||||
ContractBreaches: contractBreaches,
|
ContractBreaches: contractBreaches,
|
||||||
|
Reference in New Issue
Block a user