lightningdevkit
Version:
Lightning Development Kit
84 lines (83 loc) • 4.21 kB
text/typescript
import { ChannelId } from '../structs/ChannelId.mjs';
import { Result_ChannelMonitorUpdateDecodeErrorZ } from '../structs/Result_ChannelMonitorUpdateDecodeErrorZ.mjs';
import { CommonBase } from './CommonBase.mjs';
/**
* An update generated by the underlying channel itself which contains some new information the
* [`ChannelMonitor`] should be made aware of.
*
* Because this represents only a small number of updates to the underlying state, it is generally
* much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
* updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
* transaction), a single update may reach upwards of 1 MiB in serialized size.
*/
export declare class ChannelMonitorUpdate extends CommonBase {
/**
* The sequence number of this update. Updates *must* be replayed in-order according to this
* sequence number (and updates may panic if they are not). The update_id values are strictly
* increasing and increase by one for each new update, with two exceptions specified below.
*
* This sequence number is also used to track up to which points updates which returned
* [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
* ChannelMonitor when ChannelManager::channel_monitor_updated is called.
*
* Note that for [`ChannelMonitorUpdate`]s generated on LDK versions prior to 0.1 after the
* channel was closed, this value may be [`u64::MAX`]. In that case, multiple updates may
* appear with the same ID, and all should be replayed.
*
* [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
*/
get_update_id(): bigint;
/**
* The sequence number of this update. Updates *must* be replayed in-order according to this
* sequence number (and updates may panic if they are not). The update_id values are strictly
* increasing and increase by one for each new update, with two exceptions specified below.
*
* This sequence number is also used to track up to which points updates which returned
* [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
* ChannelMonitor when ChannelManager::channel_monitor_updated is called.
*
* Note that for [`ChannelMonitorUpdate`]s generated on LDK versions prior to 0.1 after the
* channel was closed, this value may be [`u64::MAX`]. In that case, multiple updates may
* appear with the same ID, and all should be replayed.
*
* [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
*/
set_update_id(val: bigint): void;
/**
* The channel ID associated with these updates.
*
* Will be `None` for `ChannelMonitorUpdate`s constructed on LDK versions prior to 0.0.121 and
* always `Some` otherwise.
*
* Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
get_channel_id(): ChannelId;
/**
* The channel ID associated with these updates.
*
* Will be `None` for `ChannelMonitorUpdate`s constructed on LDK versions prior to 0.0.121 and
* always `Some` otherwise.
*
* Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
set_channel_id(val: ChannelId | null): void;
clone_ptr(): bigint;
/**
* Creates a copy of the ChannelMonitorUpdate
*/
clone(): ChannelMonitorUpdate;
/**
* Checks if two ChannelMonitorUpdates contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
* Two objects with NULL inner values will be considered "equal" here.
*/
eq(b: ChannelMonitorUpdate): boolean;
/**
* Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
*/
write(): Uint8Array;
/**
* Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
*/
static constructor_read(ser: Uint8Array): Result_ChannelMonitorUpdateDecodeErrorZ;
}