|
| 1 | +package openchannel |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + |
| 6 | + "github.com/btcsuite/btcd/wire" |
| 7 | + "github.com/lightninglabs/loop/fsm" |
| 8 | + "github.com/lightninglabs/loop/staticaddr/address" |
| 9 | + "github.com/lightninglabs/loop/staticaddr/deposit" |
| 10 | + "github.com/lightninglabs/loop/staticaddr/script" |
| 11 | + "github.com/lightningnetwork/lnd/lnwallet/chainfee" |
| 12 | +) |
| 13 | + |
| 14 | +// Estimator is an interface that allows us to estimate the fee rate in sat/kw. |
| 15 | +type Estimator interface { |
| 16 | + // EstimateFeeRate estimates the fee rate in sat/kw for a transaction to |
| 17 | + // be confirmed in the given number of blocks. |
| 18 | + EstimateFeeRate(ctx context.Context, target int32) ( |
| 19 | + chainfee.SatPerKWeight, error) |
| 20 | +} |
| 21 | + |
| 22 | +// AddressManager handles fetching of address parameters. |
| 23 | +type AddressManager interface { |
| 24 | + // GetStaticAddressParameters returns the static address parameters. |
| 25 | + GetStaticAddressParameters(ctx context.Context) (*address.Parameters, |
| 26 | + error) |
| 27 | + |
| 28 | + // GetStaticAddress returns the deposit address for the given |
| 29 | + // client and server public keys. |
| 30 | + GetStaticAddress(ctx context.Context) (*script.StaticAddress, error) |
| 31 | +} |
| 32 | + |
| 33 | +type DepositManager interface { |
| 34 | + // AllOutpointsActiveDeposits returns all deposits that are in the |
| 35 | + // given state. If the state filter is fsm.StateTypeNone, all deposits |
| 36 | + // are returned. |
| 37 | + AllOutpointsActiveDeposits(outpoints []wire.OutPoint, |
| 38 | + stateFilter fsm.StateType) ([]*deposit.Deposit, bool) |
| 39 | + |
| 40 | + // GetActiveDepositsInState returns all deposits that are in the |
| 41 | + // given state. |
| 42 | + GetActiveDepositsInState(stateFilter fsm.StateType) ([]*deposit.Deposit, |
| 43 | + error) |
| 44 | + |
| 45 | + // TransitionDeposits transitions the deposits to the given state. |
| 46 | + TransitionDeposits(ctx context.Context, deposits []*deposit.Deposit, |
| 47 | + event fsm.EventType, expectedFinalState fsm.StateType) error |
| 48 | +} |
0 commit comments