Versions in this module Expand all Collapse all v0 v0.0.3 Sep 11, 2024 Changes in this version + const HtlcClaimAction + const HtlcFailNowAction + const HtlcIncomingDustFinalAction + const HtlcIncomingWatchAction + const HtlcOutgoingWatchAction + const HtlcTimeoutAction + const NoAction + var ErrChainArbExiting = errors.New("ChainArbitrator exiting") + var ErrContractNotFound = fmt.Errorf("unable to locate contract") + var ErrImmatureChannel = errors.New(...) + var LocalHtlcSet = HtlcSetKey + var RemoteHtlcSet = HtlcSetKey + var RemotePendingHtlcSet = HtlcSetKey + func DisableLog() + func UseBreachLogger(logger btclog.Logger) + func UseLogger(logger btclog.Logger) + func UseNurseryLogger(logger btclog.Logger) + type ArbChannel interface + ForceCloseChan func() (*lnwallet.LocalForceCloseSummary, error) + NewAnchorResolutions func() (*lnwallet.AnchorResolutions, error) + type ArbitratorLog interface + CommitState func(ArbitratorState) error + CurrentState func(tx kvdb.RTx) (ArbitratorState, error) + FetchChainActions func() (ChainActionMap, error) + FetchConfirmedCommitSet func(tx kvdb.RTx) (*CommitSet, error) + FetchContractResolutions func() (*ContractResolutions, error) + FetchUnresolvedContracts func() ([]ContractResolver, error) + InsertConfirmedCommitSet func(c *CommitSet) error + InsertUnresolvedContracts func(reports []*channeldb.ResolverReport, resolvers ...ContractResolver) error + LogContractResolutions func(*ContractResolutions) error + ResolveContract func(ContractResolver) error + SwapContract func(old ContractResolver, new ContractResolver) error + WipeHistory func() error + type ArbitratorState uint8 + const StateBroadcastCommit + const StateCommitmentBroadcasted + const StateContractClosed + const StateDefault + const StateError + const StateFullyResolved + const StateWaitingFullResolution + func (a ArbitratorState) String() string + type BreachArbitrator struct + func NewBreachArbitrator(cfg *BreachConfig) *BreachArbitrator + func (b *BreachArbitrator) IsBreached(chanPoint *wire.OutPoint) (bool, error) + func (b *BreachArbitrator) Start() error + func (b *BreachArbitrator) Stop() error + func (b *BreachArbitrator) SubscribeBreachComplete(chanPoint *wire.OutPoint, c chan struct{}) (bool, error) + type BreachCloseInfo struct + CloseSummary channeldb.ChannelCloseSummary + CommitHash chainhash.Hash + CommitSet CommitSet + type BreachConfig struct + CloseLink func(*wire.OutPoint, ChannelCloseType) + ContractBreaches <-chan *ContractBreachEvent + DB *channeldb.ChannelStateDB + Estimator chainfee.Estimator + GenSweepScript func() ([]byte, error) + Notifier chainntnfs.ChainNotifier + PublishTransaction func(*wire.MsgTx, string) error + Signer input.Signer + Store RetributionStorer + type BreachResolution struct + FundingOutPoint wire.OutPoint + type ChainAction uint8 + func (c ChainAction) String() string + type ChainActionMap map[ChainAction][]channeldb.HTLC + func (c ChainActionMap) Merge(actions ChainActionMap) + type ChainArbitrator struct + func NewChainArbitrator(cfg ChainArbitratorConfig, db *channeldb.DB) *ChainArbitrator + func (c *ChainArbitrator) ForceCloseContract(chanPoint wire.OutPoint) (*wire.MsgTx, error) + func (c *ChainArbitrator) GetChannelArbitrator(chanPoint wire.OutPoint) (*ChannelArbitrator, error) + func (c *ChainArbitrator) NotifyContractUpdate(chanPoint wire.OutPoint, update *ContractUpdate) error + func (c *ChainArbitrator) ResolveContract(chanPoint wire.OutPoint) error + func (c *ChainArbitrator) Start() error + func (c *ChainArbitrator) Stop() error + func (c *ChainArbitrator) SubscribeChannelEvents(chanPoint wire.OutPoint) (*ChainEventSubscription, error) + func (c *ChainArbitrator) UpdateContractSignals(chanPoint wire.OutPoint, signals *ContractSignals) error + func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error + type ChainArbitratorConfig struct + ChainHash chainhash.Hash + ChainIO lnwallet.BlockChainIO + Clock clock.Clock + ContractBreach func(wire.OutPoint, *lnwallet.BreachRetribution) error + DeliverResolutionMsg func(...ResolutionMsg) error + DisableChannel func(wire.OutPoint) error + FeeEstimator chainfee.Estimator + HtlcNotifier HtlcNotifier + IncomingBroadcastDelta uint32 + IncubateOutputs func(wire.OutPoint, *lnwallet.OutgoingHtlcResolution, ...) error + IsForwardedHTLC func(chanID lnwire.ShortChannelID, htlcIndex uint64) bool + IsOurAddress func(btcutil.Address) bool + MarkLinkInactive func(wire.OutPoint) error + Mempool chainntnfs.MempoolWatcher + NewSweepAddr func() ([]byte, error) + Notifier chainntnfs.ChainNotifier + NotifyClosedChannel func(wire.OutPoint) + NotifyFullyResolvedChannel func(point wire.OutPoint) + OnionProcessor OnionProcessor + OutgoingBroadcastDelta uint32 + PaymentsExpirationGracePeriod time.Duration + PreimageDB WitnessBeacon + PublishTx func(*wire.MsgTx, string) error + PutFinalHtlcOutcome func(chanId lnwire.ShortChannelID, htlcId uint64, settled bool) error + Registry Registry + Signer input.Signer + SubscribeBreachComplete func(op *wire.OutPoint, c chan struct{}) (bool, error) + Sweeper UtxoSweeper + type ChainEventSubscription struct + Cancel func() + ChanPoint wire.OutPoint + ContractBreach chan *BreachCloseInfo + CooperativeClosure chan *CooperativeCloseInfo + LocalUnilateralClosure chan *LocalUnilateralCloseInfo + RemoteUnilateralClosure chan *RemoteUnilateralCloseInfo + type ChannelArbitrator struct + func NewChannelArbitrator(cfg ChannelArbitratorConfig, htlcSets map[HtlcSetKey]htlcSet, ...) *ChannelArbitrator + func (c *ChannelArbitrator) Report() []*ContractReport + func (c *ChannelArbitrator) Start(state *chanArbStartState) error + func (c *ChannelArbitrator) Stop() error + func (c *ChannelArbitrator) UpdateContractSignals(newSignals *ContractSignals) + type ChannelArbitratorConfig struct + ChainEvents *ChainEventSubscription + ChanPoint wire.OutPoint + Channel ArbChannel + CloseType channeldb.ClosureType + ClosingHeight uint32 + FetchHistoricalChannel func() (*channeldb.OpenChannel, error) + IsPendingClose bool + MarkChannelClosed func(*channeldb.ChannelCloseSummary, ...channeldb.ChannelStatus) error + MarkChannelResolved func() error + MarkCommitmentBroadcasted func(*wire.MsgTx, bool) error + PutResolverReport func(tx kvdb.RwTx, report *channeldb.ResolverReport) error + ShortChanID lnwire.ShortChannelID + type ChannelCloseType uint8 + const CloseBreach + const CloseRegular + type CommitSet struct + ConfCommitKey *HtlcSetKey + HtlcSets map[HtlcSetKey][]channeldb.HTLC + func (c *CommitSet) IsEmpty() bool + type ContractBreachEvent struct + BreachRetribution *lnwallet.BreachRetribution + ChanPoint wire.OutPoint + ProcessACK func(error) + type ContractMaturityReport struct + Htlcs []HtlcMaturityReport + LimboBalance btcutil.Amount + RecoveredBalance btcutil.Amount + func (c *ContractMaturityReport) AddLimboDirectHtlc(kid *kidOutput) + func (c *ContractMaturityReport) AddLimboStage1SuccessHtlc(kid *kidOutput) + func (c *ContractMaturityReport) AddLimboStage1TimeoutHtlc(baby *babyOutput) + func (c *ContractMaturityReport) AddLimboStage2Htlc(kid *kidOutput) + func (c *ContractMaturityReport) AddRecoveredHtlc(kid *kidOutput) + type ContractReport struct + Amount btcutil.Amount + LimboBalance btcutil.Amount + MaturityHeight uint32 + Outpoint wire.OutPoint + RecoveredBalance btcutil.Amount + Stage uint32 + Type ReportOutputType + type ContractResolutions struct + AnchorResolution *lnwallet.AnchorResolution + BreachResolution *BreachResolution + CommitHash chainhash.Hash + CommitResolution *lnwallet.CommitOutputResolution + HtlcResolutions lnwallet.HtlcResolutions + func (c *ContractResolutions) IsEmpty() bool + type ContractResolver interface + Encode func(w io.Writer) error + IsResolved func() bool + Resolve func() (ContractResolver, error) + ResolverKey func() []byte + Stop func() + SupplementState func(*channeldb.OpenChannel) + type ContractSignals struct + ShortChanID lnwire.ShortChannelID + type ContractUpdate struct + HtlcKey HtlcSetKey + Htlcs []channeldb.HTLC + type CooperativeCloseInfo struct + type HtlcMaturityReport struct + Amount btcutil.Amount + MaturityHeight uint32 + Outpoint wire.OutPoint + Stage uint32 + type HtlcNotifier interface + NotifyFinalHtlcEvent func(key models.CircuitKey, info channeldb.FinalHtlcInfo) + type HtlcSetKey struct + IsPending bool + IsRemote bool + func (h HtlcSetKey) String() string + type LocalUnilateralCloseInfo struct + CommitSet CommitSet + type NurseryConfig struct + ChainIO lnwallet.BlockChainIO + ConfDepth uint32 + FetchClosedChannel func(chanID *wire.OutPoint) (*channeldb.ChannelCloseSummary, error) + FetchClosedChannels func(pendingOnly bool) ([]*channeldb.ChannelCloseSummary, error) + Notifier chainntnfs.ChainNotifier + PublishTransaction func(*wire.MsgTx, string) error + Store NurseryStorer + SweepInput func(input.Input, sweep.Params) (chan sweep.Result, error) + type NurseryStore struct + func NewNurseryStore(chainHash *chainhash.Hash, db *channeldb.DB) (*NurseryStore, error) + func (ns *NurseryStore) CribToKinder(bby *babyOutput) error + func (ns *NurseryStore) FetchClass(height uint32) ([]kidOutput, []babyOutput, error) + func (ns *NurseryStore) FetchPreschools() ([]kidOutput, error) + func (ns *NurseryStore) ForChanOutputs(chanPoint *wire.OutPoint, callback func([]byte, []byte) error, reset func()) error + func (ns *NurseryStore) GraduateKinder(height uint32, kid *kidOutput) error + func (ns *NurseryStore) HeightsBelowOrEqual(height uint32) ([]uint32, error) + func (ns *NurseryStore) Incubate(kids []kidOutput, babies []babyOutput) error + func (ns *NurseryStore) IsMatureChannel(chanPoint *wire.OutPoint) (bool, error) + func (ns *NurseryStore) ListChannels() ([]wire.OutPoint, error) + func (ns *NurseryStore) PreschoolToKinder(kid *kidOutput, lastGradHeight uint32) error + func (ns *NurseryStore) RemoveChannel(chanPoint *wire.OutPoint) error + type NurseryStorer interface + CribToKinder func(*babyOutput) error + FetchClass func(height uint32) ([]kidOutput, []babyOutput, error) + FetchPreschools func() ([]kidOutput, error) + ForChanOutputs func(*wire.OutPoint, func([]byte, []byte) error, func()) error + GraduateKinder func(height uint32, output *kidOutput) error + HeightsBelowOrEqual func(height uint32) ([]uint32, error) + Incubate func([]kidOutput, []babyOutput) error + IsMatureChannel func(*wire.OutPoint) (bool, error) + ListChannels func() ([]wire.OutPoint, error) + PreschoolToKinder func(kid *kidOutput, lastGradHeight uint32) error + RemoveChannel func(*wire.OutPoint) error + type OnionProcessor interface + ReconstructHopIterator func(r io.Reader, rHash []byte, blindingKey *btcec.PublicKey) (hop.Iterator, error) + type Registry interface + HodlUnsubscribeAll func(subscriber chan<- interface{}) + LookupInvoice func(context.Context, lntypes.Hash) (invoices.Invoice, error) + NotifyExitHopHtlc func(payHash lntypes.Hash, paidAmount lnwire.MilliSatoshi, expiry uint32, ...) (invoices.HtlcResolution, error) + type RemoteUnilateralCloseInfo struct + CommitSet CommitSet + type ReportOutputType uint8 + const ReportOutputAnchor + const ReportOutputIncomingHtlc + const ReportOutputOutgoingHtlc + const ReportOutputUnencumbered + type ResolutionMsg struct + Failure lnwire.FailureMessage + HtlcIndex uint64 + PreImage *[32]byte + SourceChan lnwire.ShortChannelID + type ResolverConfig struct + Checkpoint func(ContractResolver, ...*channeldb.ResolverReport) error + type RetributionStore struct + func NewRetributionStore(db kvdb.Backend) *RetributionStore + func (rs *RetributionStore) Add(ret *retributionInfo) error + func (rs *RetributionStore) ForAll(cb func(*retributionInfo) error, reset func()) error + func (rs *RetributionStore) IsBreached(chanPoint *wire.OutPoint) (bool, error) + func (rs *RetributionStore) Remove(chanPoint *wire.OutPoint) error + type RetributionStorer interface + Add func(retInfo *retributionInfo) error + ForAll func(cb func(*retributionInfo) error, reset func()) error + IsBreached func(chanPoint *wire.OutPoint) (bool, error) + Remove func(key *wire.OutPoint) error + type UtxoNursery struct + func NewUtxoNursery(cfg *NurseryConfig) *UtxoNursery + func (u *UtxoNursery) IncubateOutputs(chanPoint wire.OutPoint, outgoingHtlcs []lnwallet.OutgoingHtlcResolution, ...) error + func (u *UtxoNursery) NurseryReport(chanPoint *wire.OutPoint) (*ContractMaturityReport, error) + func (u *UtxoNursery) RemoveChannel(op *wire.OutPoint) error + func (u *UtxoNursery) Start() error + func (u *UtxoNursery) Stop() error + type UtxoSweeper interface + CreateSweepTx func(inputs []input.Input, feePref sweep.FeePreference, currentBlockHeight uint32) (*wire.MsgTx, error) + RelayFeePerKW func() chainfee.SatPerKWeight + SweepInput func(input input.Input, params sweep.Params) (chan sweep.Result, error) + UpdateParams func(input wire.OutPoint, params sweep.ParamsUpdate) (chan sweep.Result, error) + type WitnessBeacon interface + AddPreimages func(preimages ...lntypes.Preimage) error + LookupPreimage func(payhash lntypes.Hash) (lntypes.Preimage, bool) + SubscribeUpdates func(chanID lnwire.ShortChannelID, htlc *channeldb.HTLC, payload *hop.Payload, ...) (*WitnessSubscription, error) + type WitnessSubscription struct + CancelSubscription func() + WitnessUpdates <-chan lntypes.Preimage