Table of Contents

Class HtlcDbRepository

Namespace
NLightning.Infrastructure.Repositories.Database.Channel
Assembly
NLightning.Infrastructure.Repositories.dll
public class HtlcDbRepository : BaseDbRepository<HtlcEntity>, IHtlcDbRepository
Inheritance
HtlcDbRepository
Implements
Inherited Members

Constructors

HtlcDbRepository(NLightningDbContext, IMessageSerializer)

public HtlcDbRepository(NLightningDbContext context, IMessageSerializer messageSerializer)

Parameters

context NLightningDbContext
messageSerializer IMessageSerializer

Methods

AddAsync(ChannelId, Htlc)

Adds a new HTLC to a channel

public Task AddAsync(ChannelId channelId, Htlc htlc)

Parameters

channelId ChannelId

Channel ID

htlc Htlc

HTLC to add

Returns

Task

DeleteAllForChannelId(ChannelId)

Deletes all HTLCs for a channel

public void DeleteAllForChannelId(ChannelId channelId)

Parameters

channelId ChannelId

Channel ID

DeleteAsync(ChannelId, ulong, HtlcDirection)

Deletes an HTLC

public Task DeleteAsync(ChannelId channelId, ulong htlcId, HtlcDirection direction)

Parameters

channelId ChannelId

Channel ID

htlcId ulong

HTLC ID

direction HtlcDirection

HTLC direction (incoming/outgoing)

Returns

Task

GetAllForChannelAsync(ChannelId)

Gets all HTLCs for a channel

public Task<IEnumerable<Htlc>> GetAllForChannelAsync(ChannelId channelId)

Parameters

channelId ChannelId

Channel ID

Returns

Task<IEnumerable<Htlc>>

Collection of HTLCs

GetByChannelIdAndDirectionAsync(ChannelId, HtlcDirection)

Gets HTLCs for a channel with a specific direction

public Task<IEnumerable<Htlc>> GetByChannelIdAndDirectionAsync(ChannelId channelId, HtlcDirection direction)

Parameters

channelId ChannelId

Channel ID

direction HtlcDirection

HTLC direction (incoming/outgoing)

Returns

Task<IEnumerable<Htlc>>

Collection of HTLCs matching the direction

GetByChannelIdAndStateAsync(ChannelId, HtlcState)

Gets HTLCs for a channel with a specific state

public Task<IEnumerable<Htlc>> GetByChannelIdAndStateAsync(ChannelId channelId, HtlcState state)

Parameters

channelId ChannelId

Channel ID

state HtlcState

HTLC state

Returns

Task<IEnumerable<Htlc>>

Collection of HTLCs matching the state

GetByIdAsync(ChannelId, ulong, HtlcDirection)

Gets a specific HTLC

public Task<Htlc?> GetByIdAsync(ChannelId channelId, ulong htlcId, HtlcDirection direction)

Parameters

channelId ChannelId

Channel ID

htlcId ulong

HTLC ID

direction HtlcDirection

HTLC direction (incoming/outgoing)

Returns

Task<Htlc?>

HTLC or null if not found

UpdateAsync(ChannelId, Htlc)

Updates an existing HTLC

public Task UpdateAsync(ChannelId channelId, Htlc htlc)

Parameters

channelId ChannelId

Channel ID

htlc Htlc

Updated HTLC

Returns

Task