Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaymentShard ¶
type PaymentShard interface { // Hash returns the hash used for the HTLC representing this shard. Hash() lntypes.Hash // MPP returns any extra MPP records that should be set for the final // hop on the route used by this shard. MPP() *record.MPP // AMP returns any extra AMP records that should be set for the final // hop on the route used by this shard. AMP() *record.AMP }
PaymentShard is an interface representing a shard tracked by the ShardTracker. It contains options that are specific to the given shard that might differ from the overall payment.
type Shard ¶
type Shard struct {
// contains filtered or unexported fields
}
Shard is a struct used for simple shards where we obly need to keep map it to a single hash.
func (*Shard) AMP ¶
AMP returns any extra AMP records that should be set for the final hop on the route used by this shard.
type ShardTracker ¶
type ShardTracker interface { // NewShard registers a new attempt with the ShardTracker and returns a // new shard representing this attempt. This attempt's shard should be // canceled if it ends up not being used by the overall payment, i.e. // if the attempt fails. NewShard(uint64, bool) (PaymentShard, error) // CancelShard cancel's the shard corresponding to the given attempt // ID. This lets the ShardTracker free up any slots used by this shard, // and in case of AMP payments return the share used by this shard to // the root share. CancelShard(uint64) error // GetHash retrieves the hash used by the shard of the given attempt // ID. This wil return an error if the attempt ID is unknown. GetHash(uint64) (lntypes.Hash, error) }
ShardTracker is an interfae representing a tracker that keeps track of the inflight shards of a payment, and is able to assign new shards the correct options such as hash and extra records.
func NewSimpleShardTracker ¶
NewSimpleShardTracker creates a new intance of the SimpleShardTracker with the given payment hash and existing attempts.
type SimpleShardTracker ¶
SimpleShardTracker is an implementation of the ShardTracker interface that simply maps attempt IDs to hashes. New shards will be given a static payment hash. This should be used for regular and MPP payments, in addition to resumed payments where all the attempt's hashes have already been created.
func (*SimpleShardTracker) CancelShard ¶
func (m *SimpleShardTracker) CancelShard(id uint64) error
CancelShard cancel's the shard corresponding to the given attempt ID.
func (*SimpleShardTracker) GetHash ¶
func (m *SimpleShardTracker) GetHash(id uint64) (lntypes.Hash, error)
GetHash retrieves the hash used by the shard of the given attempt ID. This will return an error if the attempt ID is unknown.
func (*SimpleShardTracker) NewShard ¶
func (m *SimpleShardTracker) NewShard(id uint64, _ bool) (PaymentShard, error)
NewShard registers a new attempt with the ShardTracker and returns a new shard representing this attempt. This attempt's shard should be canceled if it ends up not being used by the overall payment, i.e. if the attempt fails.