mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Treat lnd wallet view as the source of spendable static-address outputs while keeping historical deposit records in the DB. Reconcile active FSMs against the current wallet view and reactivate known deposits when their outpoints are visible again. Refresh deposits before selection, withdrawal, loop-in, and channel-open paths, and filter list and summary responses through the live active set so stale Deposited records are not exposed as available funds.
40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
package openchannel
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/btcsuite/btcd/btcutil"
|
|
"github.com/btcsuite/btcd/wire"
|
|
"github.com/lightninglabs/loop/fsm"
|
|
"github.com/lightninglabs/loop/staticaddr/deposit"
|
|
"github.com/lightningnetwork/lnd/lnrpc"
|
|
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
|
)
|
|
|
|
type DepositManager interface {
|
|
// EnsureDepositsFresh reconciles active deposits with the wallet view.
|
|
EnsureDepositsFresh(ctx context.Context) error
|
|
|
|
// AllOutpointsActiveDeposits returns all deposits that are in the
|
|
// given state. If the state filter is fsm.StateTypeNone, all deposits
|
|
// are returned.
|
|
AllOutpointsActiveDeposits(outpoints []wire.OutPoint,
|
|
stateFilter fsm.StateType) ([]*deposit.Deposit, bool)
|
|
|
|
// GetActiveDepositsInState returns all deposits that are in the
|
|
// given state.
|
|
GetActiveDepositsInState(stateFilter fsm.StateType) ([]*deposit.Deposit,
|
|
error)
|
|
|
|
// TransitionDeposits transitions the deposits to the given state.
|
|
TransitionDeposits(ctx context.Context, deposits []*deposit.Deposit,
|
|
event fsm.EventType, expectedFinalState fsm.StateType) error
|
|
}
|
|
|
|
type WithdrawalManager interface {
|
|
CreateFinalizedWithdrawalTx(ctx context.Context,
|
|
deposits []*deposit.Deposit, withdrawalAddress btcutil.Address,
|
|
feeRate chainfee.SatPerKWeight,
|
|
selectedWithdrawalAmount int64,
|
|
commitmentType lnrpc.CommitmentType) (*wire.MsgTx, []byte, error)
|
|
}
|