Versions in this module Expand all Collapse all v1 v1.0.0 May 10, 2019 Changes in this version + const DefaultFwdEventInterval + const DefaultLogInterval + const DefaultMaxLinkFeeUpdateTimeout + const DefaultMinLinkFeeUpdateTimeout + const EncrypterTypeMock + const EncrypterTypeNone + const EncrypterTypeSphinx + const ErrInternalError + const ErrInvalidCommitment + const ErrInvalidRevocation + const ErrInvalidUpdate + const ErrRemoteError + const ErrSyncError + var ErrAlreadyPaid = errors.New("invoice is already paid") + var ErrChannelLinkNotFound = errors.New("channel link not found") + var ErrCircuitClosing = errors.New("circuit has already been closed") + var ErrCircuitNotInHashIndex = errors.New(...) + var ErrCorruptedCircuitMap = errors.New("circuit map has been corrupted") + var ErrDecayedLogCorrupted = errors.New("decayed log structure corrupted") + var ErrDecayedLogInit = errors.New("unable to initialize decayed log") + var ErrDuplicateAdd = errors.New("duplicate add HTLC detected") + var ErrDuplicateCircuit = errors.New("duplicate circuit add") + var ErrDuplicateKeystone = errors.New("cannot add duplicate keystone") + var ErrIncompleteForward = errors.New("incomplete forward detected") + var ErrLinkShuttingDown = errors.New("link shutting down") + var ErrMailBoxShuttingDown = errors.New("mailbox is shutting down") + var ErrNoLinksFound = errors.New("no channel links found") + var ErrPaymentAlreadyCompleted = errors.New("payment is already completed") + var ErrPaymentInFlight = errors.New("payment is in transition") + var ErrPaymentNotInitiated = errors.New("payment isn't initiated") + var ErrSequencerCorrupted = errors.New("sequencer database has been corrupted") + var ErrSwitchExiting = errors.New("htlcswitch shutting down") + var ErrUnknownCircuit = errors.New("unknown payment circuit") + var ErrUnknownErrorDecryptor = errors.New("unknown error decryptor") + var ErrUnknownKeystone = errors.New("unknown circuit keystone") + var ErrUnknownPaymentStatus = errors.New("unknown payment status") + func DisableLog() + func ExpectedFee(f ForwardingPolicy, htlcAmt lnwire.MilliSatoshi) lnwire.MilliSatoshi + func UseLogger(logger btclog.Logger) + type ChanClose struct + ChanPoint *wire.OutPoint + CloseType ChannelCloseType + Err chan error + TargetFeePerKw lnwallet.SatPerKWeight + Updates chan interface{} + type ChannelCloseType uint8 + const CloseBreach + const CloseRegular + type ChannelLink interface + AttachMailBox func(MailBox) + Bandwidth func() lnwire.MilliSatoshi + ChanID func() lnwire.ChannelID + ChannelPoint func() *wire.OutPoint + EligibleToForward func() bool + HandleChannelUpdate func(lnwire.Message) + HandleSwitchPacket func(*htlcPacket) error + HtlcSatifiesPolicy func(payHash [32]byte, incomingAmt lnwire.MilliSatoshi, ...) lnwire.FailureMessage + HtlcSatifiesPolicyLocal func(payHash [32]byte, amt lnwire.MilliSatoshi, timeout uint32, heightNow uint32) lnwire.FailureMessage + Peer func() lnpeer.Peer + ShortChanID func() lnwire.ShortChannelID + Start func() error + Stats func() (uint64, lnwire.MilliSatoshi, lnwire.MilliSatoshi) + Stop func() + UpdateForwardingPolicy func(ForwardingPolicy) + UpdateShortChanID func() (lnwire.ShortChannelID, error) + func NewChannelLink(cfg ChannelLinkConfig, channel *lnwallet.LightningChannel) ChannelLink + type ChannelLinkConfig struct + BatchSize uint32 + BatchTicker ticker.Ticker + ChainEvents *contractcourt.ChainEventSubscription + Circuits CircuitModifier + DebugHTLC bool + DecodeHopIterators func([]byte, []DecodeHopIteratorRequest) ([]DecodeHopIteratorResponse, error) + ExtractErrorEncrypter ErrorEncrypterExtracter + FeeEstimator lnwallet.FeeEstimator + FetchLastChannelUpdate func(lnwire.ShortChannelID) (*lnwire.ChannelUpdate, error) + FinalCltvRejectDelta uint32 + ForwardPackets func(chan struct{}, ...*htlcPacket) chan error + FwdPkgGCTicker ticker.Ticker + FwrdingPolicy ForwardingPolicy + HodlMask hodl.Mask + MaxFeeUpdateTimeout time.Duration + MinFeeUpdateTimeout time.Duration + OnChannelFailure func(lnwire.ChannelID, lnwire.ShortChannelID, LinkFailureError) + OutgoingCltvRejectDelta uint32 + Peer lnpeer.Peer + PreimageCache contractcourt.WitnessBeacon + Registry InvoiceDatabase + Switch *Switch + SyncStates bool + UnsafeReplay bool + UpdateContractSignals func(*contractcourt.ContractSignals) error + type CircuitFwdActions struct + Adds []*PaymentCircuit + Drops []*PaymentCircuit + Fails []*PaymentCircuit + type CircuitKey = channeldb.CircuitKey + var EmptyCircuitKey CircuitKey + type CircuitMap interface + CloseCircuit func(outKey CircuitKey) (*PaymentCircuit, error) + CommitCircuits func(circuit ...*PaymentCircuit) (*CircuitFwdActions, error) + FailCircuit func(inKey CircuitKey) (*PaymentCircuit, error) + LookupByPaymentHash func(hash [32]byte) []*PaymentCircuit + LookupCircuit func(inKey CircuitKey) *PaymentCircuit + LookupOpenCircuit func(outKey CircuitKey) *PaymentCircuit + NumOpen func() int + NumPending func() int + func NewCircuitMap(cfg *CircuitMapConfig) (CircuitMap, error) + type CircuitMapConfig struct + DB *channeldb.DB + ExtractErrorEncrypter ErrorEncrypterExtracter + type CircuitModifier interface + DeleteCircuits func(inKeys ...CircuitKey) error + OpenCircuits func(...Keystone) error + TrimOpenCircuits func(chanID lnwire.ShortChannelID, start uint64) error + type Config struct + DB *channeldb.DB + ExtractErrorEncrypter ErrorEncrypterExtracter + FetchLastChannelUpdate func(lnwire.ShortChannelID) (*lnwire.ChannelUpdate, error) + FwdEventTicker ticker.Ticker + FwdingLog ForwardingLog + LocalChannelClose func(pubKey []byte, request *ChanClose) + LogEventTicker ticker.Ticker + Notifier chainntnfs.ChainNotifier + NotifyActiveChannel func(wire.OutPoint) + NotifyInactiveChannel func(wire.OutPoint) + SelfKey *btcec.PublicKey + SwitchPackager channeldb.FwdOperator + type ControlTower interface + ClearForTakeoff func(htlc *lnwire.UpdateAddHTLC) error + Fail func(paymentHash [32]byte) error + Success func(paymentHash [32]byte) error + func NewPaymentControl(strict bool, db *channeldb.DB) ControlTower + type DecayedLog struct + func NewDecayedLog(dbPath string, notifier chainntnfs.ChainNotifier) *DecayedLog + func (d *DecayedLog) Delete(hash *sphinx.HashPrefix) error + func (d *DecayedLog) Get(hash *sphinx.HashPrefix) (uint32, error) + func (d *DecayedLog) Put(hash *sphinx.HashPrefix, cltv uint32) error + func (d *DecayedLog) PutBatch(b *sphinx.Batch) (*sphinx.ReplaySet, error) + func (d *DecayedLog) Start() error + func (d *DecayedLog) Stop() error + type DecodeHopIteratorRequest struct + IncomingCltv uint32 + OnionReader io.Reader + RHash []byte + type DecodeHopIteratorResponse struct + FailCode lnwire.FailCode + HopIterator HopIterator + func (r *DecodeHopIteratorResponse) Result() (HopIterator, lnwire.FailCode) + type EncrypterType byte + type ErrorDecrypter interface + DecryptError func(lnwire.OpaqueReason) (*ForwardingError, error) + type ErrorEncrypter interface + Decode func(io.Reader) error + Encode func(io.Writer) error + EncryptFirstHop func(lnwire.FailureMessage) (lnwire.OpaqueReason, error) + EncryptMalformedError func(lnwire.OpaqueReason) lnwire.OpaqueReason + IntermediateEncrypt func(lnwire.OpaqueReason) lnwire.OpaqueReason + Reextract func(ErrorEncrypterExtracter) error + Type func() EncrypterType + func NewMockObfuscator() ErrorEncrypter + type ErrorEncrypterExtracter func(*btcec.PublicKey) (ErrorEncrypter, lnwire.FailCode) + type ForwardingError struct + ErrorSource *btcec.PublicKey + ExtraMsg string + func (f *ForwardingError) Error() string + type ForwardingInfo struct + AmountToForward lnwire.MilliSatoshi + Network NetworkHop + NextHop lnwire.ShortChannelID + OutgoingCTLV uint32 + type ForwardingLog interface + AddForwardingEvents func([]channeldb.ForwardingEvent) error + type ForwardingPolicy struct + BaseFee lnwire.MilliSatoshi + FeeRate lnwire.MilliSatoshi + MaxHTLC lnwire.MilliSatoshi + MinHTLC lnwire.MilliSatoshi + TimeLockDelta uint32 + type HopIterator interface + EncodeNextHop func(w io.Writer) error + ExtractErrorEncrypter func(ErrorEncrypterExtracter) (ErrorEncrypter, lnwire.FailCode) + ForwardingInstructions func() ForwardingInfo + type InvoiceDatabase interface + CancelInvoice func(payHash lntypes.Hash) error + HodlUnsubscribeAll func(subscriber chan<- interface{}) + LookupInvoice func(lntypes.Hash) (channeldb.Invoice, uint32, error) + NotifyExitHopHtlc func(payHash lntypes.Hash, paidAmount lnwire.MilliSatoshi, ...) (*invoices.HodlEvent, error) + SettleHodlInvoice func(preimage lntypes.Preimage) error + type Keystone struct + InKey CircuitKey + OutKey CircuitKey + func (k *Keystone) String() string + type LinkFailureError struct + ForceClose bool + SendData []byte + func (e LinkFailureError) Error() string + func (e LinkFailureError) ShouldSendToPeer() bool + type MailBox interface + AckPacket func(CircuitKey) error + AddMessage func(msg lnwire.Message) error + AddPacket func(pkt *htlcPacket) error + HasPacket func(CircuitKey) bool + MessageOutBox func() chan lnwire.Message + PacketOutBox func() chan *htlcPacket + ResetMessages func() error + ResetPackets func() error + Start func() error + Stop func() error + type NetworkHop uint8 + const BitcoinHop + const LitecoinfinanceHop + func (c NetworkHop) String() string + type OnionProcessor struct + func NewOnionProcessor(router *sphinx.Router) *OnionProcessor + func (p *OnionProcessor) DecodeHopIterator(r io.Reader, rHash []byte, incomingCltv uint32) (HopIterator, lnwire.FailCode) + func (p *OnionProcessor) DecodeHopIterators(id []byte, reqs []DecodeHopIteratorRequest) ([]DecodeHopIteratorResponse, error) + func (p *OnionProcessor) ExtractErrorEncrypter(ephemeralKey *btcec.PublicKey) (ErrorEncrypter, lnwire.FailCode) + func (p *OnionProcessor) Start() error + func (p *OnionProcessor) Stop() error + type PaymentCircuit struct + AddRef channeldb.AddRef + ErrorEncrypter ErrorEncrypter + Incoming CircuitKey + IncomingAmount lnwire.MilliSatoshi + LoadedFromDisk bool + Outgoing *CircuitKey + OutgoingAmount lnwire.MilliSatoshi + PaymentHash [32]byte + func (c *PaymentCircuit) Decode(r io.Reader) error + func (c *PaymentCircuit) Encode(w io.Writer) error + func (c *PaymentCircuit) HasKeystone() bool + func (c *PaymentCircuit) InKey() CircuitKey + func (c *PaymentCircuit) OutKey() CircuitKey + type Sequencer interface + NextID func() (uint64, error) + func NewPersistentSequencer(db *channeldb.DB) (Sequencer, error) + type SphinxErrorDecrypter struct + func (s *SphinxErrorDecrypter) DecryptError(reason lnwire.OpaqueReason) (*ForwardingError, error) + type SphinxErrorEncrypter struct + EphemeralKey *btcec.PublicKey + func NewSphinxErrorEncrypter() *SphinxErrorEncrypter + func (s *SphinxErrorEncrypter) Decode(r io.Reader) error + func (s *SphinxErrorEncrypter) Encode(w io.Writer) error + func (s *SphinxErrorEncrypter) EncryptFirstHop(failure lnwire.FailureMessage) (lnwire.OpaqueReason, error) + func (s *SphinxErrorEncrypter) EncryptMalformedError(reason lnwire.OpaqueReason) lnwire.OpaqueReason + func (s *SphinxErrorEncrypter) IntermediateEncrypt(reason lnwire.OpaqueReason) lnwire.OpaqueReason + func (s *SphinxErrorEncrypter) Reextract(extract ErrorEncrypterExtracter) error + func (s *SphinxErrorEncrypter) Type() EncrypterType + type Switch struct + func New(cfg Config, currentHeight uint32) (*Switch, error) + func (s *Switch) AddLink(link ChannelLink) error + func (s *Switch) BestHeight() uint32 + func (s *Switch) CircuitModifier() CircuitModifier + func (s *Switch) CloseLink(chanPoint *wire.OutPoint, closeType ChannelCloseType, ...) (chan interface{}, chan error) + func (s *Switch) FlushForwardingEvents() error + func (s *Switch) ForwardPackets(linkQuit chan struct{}, packets ...*htlcPacket) chan error + func (s *Switch) GetLink(chanID lnwire.ChannelID) (ChannelLink, error) + func (s *Switch) GetLinksByInterface(hop [33]byte) ([]ChannelLink, error) + func (s *Switch) HasActiveLink(chanID lnwire.ChannelID) bool + func (s *Switch) ProcessContractResolution(msg contractcourt.ResolutionMsg) error + func (s *Switch) RemoveLink(chanID lnwire.ChannelID) + func (s *Switch) SendHTLC(firstHop lnwire.ShortChannelID, htlc *lnwire.UpdateAddHTLC, ...) ([sha256.Size]byte, error) + func (s *Switch) Start() error + func (s *Switch) Stop() error + func (s *Switch) UpdateForwardingPolicies(newPolicy ForwardingPolicy, targetChans ...wire.OutPoint) error + func (s *Switch) UpdateShortChanID(chanID lnwire.ChannelID) error + type UnknownEncrypterType EncrypterType + func (e UnknownEncrypterType) Error() string