@@ -198,74 +198,6 @@ func (l *StaticAddressLoopIn) createMusig2Session(ctx context.Context,
198198 )
199199}
200200
201- // createSweeplessSweepTx creates the sweepless sweep transaction that the
202- // server wishes to publish. It spends the deposit outpoints to a
203- // server-specified sweep address.
204- func (l * StaticAddressLoopIn ) createSweeplessSweepTx (address btcutil.Address ,
205- feeRate chainfee.SatPerKWeight ) (* wire.MsgTx , error ) {
206- // Create the tx.
207- msgTx := wire .NewMsgTx (2 )
208-
209- // Add the deposit inputs to the transaction in the order the server
210- // signed them.
211- outpoints := l .Outpoints ()
212- for _ , outpoint := range outpoints {
213- msgTx .AddTxIn (& wire.TxIn {
214- PreviousOutPoint : outpoint ,
215- })
216- }
217-
218- // Calculate tx fee for the server provided fee rate.
219- weight , err := sweeplessSweepWeight (len (outpoints ), address )
220- if err != nil {
221- return nil , err
222- }
223- fee := feeRate .FeeForWeight (weight )
224-
225- pkscript , err := txscript .PayToAddrScript (address )
226- if err != nil {
227- return nil , err
228- }
229-
230- // Create the sweep output.
231- sweepOutput := & wire.TxOut {
232- Value : int64 (l .TotalDepositAmount ()) - int64 (fee ),
233- PkScript : pkscript ,
234- }
235-
236- msgTx .AddTxOut (sweepOutput )
237-
238- return msgTx , nil
239- }
240-
241- // sweeplessSweepWeight returns weight units for a sweepless sweep transaction
242- // with N taproot inputs and one sweep output.
243- func sweeplessSweepWeight (numInputs int ,
244- sweepAddress btcutil.Address ) (lntypes.WeightUnit , error ) {
245-
246- var weightEstimator input.TxWeightEstimator
247- for i := 0 ; i < numInputs ; i ++ {
248- weightEstimator .AddTaprootKeySpendInput (
249- txscript .SigHashDefault ,
250- )
251- }
252-
253- // Get the weight of the sweep output.
254- switch sweepAddress .(type ) {
255- case * btcutil.AddressWitnessPubKeyHash :
256- weightEstimator .AddP2WKHOutput ()
257-
258- case * btcutil.AddressTaproot :
259- weightEstimator .AddP2TROutput ()
260-
261- default :
262- return 0 , fmt .Errorf ("invalid sweep address type %T" ,
263- sweepAddress )
264- }
265-
266- return weightEstimator .Weight (), nil
267- }
268-
269201// signMusig2Tx adds the server nonces to the musig2 sessions and signs the
270202// transaction.
271203func (l * StaticAddressLoopIn ) signMusig2Tx (ctx context.Context ,
0 commit comments