Table of Contents

Interface IHtlcDbRepository

Namespace
NLightning.Domain.Channels.Interfaces
Assembly
NLightning.Domain.dll

Repository interface for managing HTLC (Hashed Time-Locked Contract) entities

public interface IHtlcDbRepository

Methods

AddAsync(ChannelId, Htlc)

Adds a new HTLC to a channel

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

void DeleteAllForChannelId(ChannelId channelId)

Parameters

channelId ChannelId

Channel ID

DeleteAsync(ChannelId, ulong, HtlcDirection)

Deletes an HTLC

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

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

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

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

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

Task UpdateAsync(ChannelId channelId, Htlc htlc)

Parameters

channelId ChannelId

Channel ID

htlc Htlc

Updated HTLC

Returns

Task