staticaddr/loopin: remove unused code

This commit is contained in:
sputn1ck 2024-11-14 15:36:03 +01:00 committed by Slyghtning
parent a98e16184e
commit 115558bed5
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF
3 changed files with 0 additions and 90 deletions

View file

@ -54,17 +54,6 @@ func (m *mockStaticAddressClient) PushStaticAddressSweeplessSigs(ctx context.Con
args.Error(1)
}
func (m *mockStaticAddressClient) FetchSweeplessSweepTx(ctx context.Context,
in *swapserverrpc.FetchSweeplessSweepTxRequest,
opts ...grpc.CallOption) (
*swapserverrpc.FetchSweeplessSweepTxResponse, error) {
args := m.Called(ctx, in, opts)
return args.Get(0).(*swapserverrpc.FetchSweeplessSweepTxResponse),
args.Error(1)
}
func (m *mockStaticAddressClient) PushStaticAddressHtlcSigs(ctx context.Context,
in *swapserverrpc.PushStaticAddressHtlcSigsRequest,
opts ...grpc.CallOption) (

View file

@ -73,17 +73,6 @@ func (m *mockStaticAddressClient) PushStaticAddressSweeplessSigs(ctx context.Con
args.Error(1)
}
func (m *mockStaticAddressClient) FetchSweeplessSweepTx(ctx context.Context,
in *swapserverrpc.FetchSweeplessSweepTxRequest,
opts ...grpc.CallOption) (
*swapserverrpc.FetchSweeplessSweepTxResponse, error) {
args := m.Called(ctx, in, opts)
return args.Get(0).(*swapserverrpc.FetchSweeplessSweepTxResponse),
args.Error(1)
}
func (m *mockStaticAddressClient) PushStaticAddressHtlcSigs(ctx context.Context,
in *swapserverrpc.PushStaticAddressHtlcSigsRequest,
opts ...grpc.CallOption) (

View file

@ -198,74 +198,6 @@ func (l *StaticAddressLoopIn) createMusig2Session(ctx context.Context,
)
}
// createSweeplessSweepTx creates the sweepless sweep transaction that the
// server wishes to publish. It spends the deposit outpoints to a
// server-specified sweep address.
func (l *StaticAddressLoopIn) createSweeplessSweepTx(address btcutil.Address,
feeRate chainfee.SatPerKWeight) (*wire.MsgTx, error) {
// Create the tx.
msgTx := wire.NewMsgTx(2)
// Add the deposit inputs to the transaction in the order the server
// signed them.
outpoints := l.Outpoints()
for _, outpoint := range outpoints {
msgTx.AddTxIn(&wire.TxIn{
PreviousOutPoint: outpoint,
})
}
// Calculate tx fee for the server provided fee rate.
weight, err := sweeplessSweepWeight(len(outpoints), address)
if err != nil {
return nil, err
}
fee := feeRate.FeeForWeight(weight)
pkscript, err := txscript.PayToAddrScript(address)
if err != nil {
return nil, err
}
// Create the sweep output.
sweepOutput := &wire.TxOut{
Value: int64(l.TotalDepositAmount()) - int64(fee),
PkScript: pkscript,
}
msgTx.AddTxOut(sweepOutput)
return msgTx, nil
}
// sweeplessSweepWeight returns weight units for a sweepless sweep transaction
// with N taproot inputs and one sweep output.
func sweeplessSweepWeight(numInputs int,
sweepAddress btcutil.Address) (lntypes.WeightUnit, error) {
var weightEstimator input.TxWeightEstimator
for i := 0; i < numInputs; i++ {
weightEstimator.AddTaprootKeySpendInput(
txscript.SigHashDefault,
)
}
// Get the weight of the sweep output.
switch sweepAddress.(type) {
case *btcutil.AddressWitnessPubKeyHash:
weightEstimator.AddP2WKHOutput()
case *btcutil.AddressTaproot:
weightEstimator.AddP2TROutput()
default:
return 0, fmt.Errorf("invalid sweep address type %T",
sweepAddress)
}
return weightEstimator.Weight(), nil
}
// signMusig2Tx adds the server nonces to the musig2 sessions and signs the
// transaction.
func (l *StaticAddressLoopIn) signMusig2Tx(ctx context.Context,