Documentation ¶
Overview ¶
Package payments provides an abstraction above the implementation for handling Lightning Network payments and storing pending payments awaiting session keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PayChan ¶ added in v0.1.16
type PayChan chan *Payment
PayChan is a channel for sending and receiving payments between the LN interface and the Engine.
type Payment ¶
type Payment struct { // ID is the unique identifier that will be used internally also for the session // when the session onion arrives. ID nonce.ID // Preimage is the hash of the pair of secret keys that proves a session key set // should be tied to the provided secret keys for decrypting onions for this // session. Preimage sha256.Hash // Amount in millisatoshi that have been received over LN. Amount lnwire.MilliSatoshi // ConfirmChan signals from the LN server to the Engine that the payment is // complete, and if available the session can now be spent from. ConfirmChan chan bool }
Payment is the essential details of a payment and the method to wait for full confirmation.
type PendingPayments ¶
type PendingPayments []*Payment
PendingPayments is a slice of Payments used to store the queue of payments awaiting sessions.
func (PendingPayments) Add ¶
func (p PendingPayments) Add(np *Payment) (pp PendingPayments)
Add a new payment to the PendingPayments and return the mutated slice.
func (PendingPayments) Delete ¶
func (p PendingPayments) Delete(preimage sha256.Hash) (pp PendingPayments)
Delete a pending payment and return the mutated slice with the item matching the preimage removed.
func (PendingPayments) Find ¶
func (p PendingPayments) Find(id nonce.ID) (pp *Payment)
Find the pending payment with the matching nonce.ID (internal reference).
func (PendingPayments) FindPreimage ¶
func (p PendingPayments) FindPreimage(pi sha256.Hash) (pp *Payment)
FindPreimage searches for a match for the preimage hash, as would be needed after receiving the preimage in the payment the session's keys derive the preimage for this search.