Skip to content

Commit 115558b

Browse files
sputn1ckhieblmi
authored andcommitted
staticaddr/loopin: remove unused code
1 parent a98e161 commit 115558b

File tree

3 files changed

+0
-90
lines changed

3 files changed

+0
-90
lines changed

staticaddr/address/manager_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,6 @@ func (m *mockStaticAddressClient) PushStaticAddressSweeplessSigs(ctx context.Con
5454
args.Error(1)
5555
}
5656

57-
func (m *mockStaticAddressClient) FetchSweeplessSweepTx(ctx context.Context,
58-
in *swapserverrpc.FetchSweeplessSweepTxRequest,
59-
opts ...grpc.CallOption) (
60-
*swapserverrpc.FetchSweeplessSweepTxResponse, error) {
61-
62-
args := m.Called(ctx, in, opts)
63-
64-
return args.Get(0).(*swapserverrpc.FetchSweeplessSweepTxResponse),
65-
args.Error(1)
66-
}
67-
6857
func (m *mockStaticAddressClient) PushStaticAddressHtlcSigs(ctx context.Context,
6958
in *swapserverrpc.PushStaticAddressHtlcSigsRequest,
7059
opts ...grpc.CallOption) (

staticaddr/deposit/manager_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,6 @@ func (m *mockStaticAddressClient) PushStaticAddressSweeplessSigs(ctx context.Con
7373
args.Error(1)
7474
}
7575

76-
func (m *mockStaticAddressClient) FetchSweeplessSweepTx(ctx context.Context,
77-
in *swapserverrpc.FetchSweeplessSweepTxRequest,
78-
opts ...grpc.CallOption) (
79-
*swapserverrpc.FetchSweeplessSweepTxResponse, error) {
80-
81-
args := m.Called(ctx, in, opts)
82-
83-
return args.Get(0).(*swapserverrpc.FetchSweeplessSweepTxResponse),
84-
args.Error(1)
85-
}
86-
8776
func (m *mockStaticAddressClient) PushStaticAddressHtlcSigs(ctx context.Context,
8877
in *swapserverrpc.PushStaticAddressHtlcSigsRequest,
8978
opts ...grpc.CallOption) (

staticaddr/loopin/loopin.go

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
271203
func (l *StaticAddressLoopIn) signMusig2Tx(ctx context.Context,

0 commit comments

Comments
 (0)