Skip to content

Commit

Permalink
WIP: update lnd to 0-19-staging-rebased branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jamaljsr committed Sep 9, 2024
1 parent 1edd3ae commit ce854ee
Show file tree
Hide file tree
Showing 20 changed files with 812 additions and 15 deletions.
57 changes: 56 additions & 1 deletion lib/types/proto/lnd/invoicesrpc/invoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,50 @@ export interface LookupInvoiceMsg {
lookupModifier: LookupModifier;
}

/** CircuitKey is a unique identifier for an HTLC. */
export interface CircuitKey {
/** / The id of the channel that the is part of this circuit. */
chanId: string;
/** / The index of the incoming htlc in the incoming channel. */
htlcId: string;
}

export interface HtlcModifyRequest {
/**
* The invoice the intercepted HTLC is attempting to settle. The HTLCs in
* the invoice are only HTLCs that have already been accepted or settled,
* not including the current intercepted HTLC.
*/
invoice: Invoice | undefined;
/** The unique identifier of the HTLC of this intercepted HTLC. */
exitHtlcCircuitKey: CircuitKey | undefined;
/** The amount in milli-satoshi that the exit HTLC is attempting to pay. */
exitHtlcAmt: string;
/** The absolute expiry height of the exit HTLC. */
exitHtlcExpiry: number;
/** The current block height. */
currentHeight: number;
/** The wire message custom records of the exit HTLC. */
exitHtlcWireCustomRecords: { [key: string]: Uint8Array | string };
}

export interface HtlcModifyRequest_ExitHtlcWireCustomRecordsEntry {
key: string;
value: Uint8Array | string;
}

export interface HtlcModifyResponse {
/** The circuit key of the HTLC that the client wants to modify. */
circuitKey: CircuitKey | undefined;
/**
* The modified amount in milli-satoshi that the exit HTLC is paying. This
* value can be different from the actual on-chain HTLC amount, in case the
* HTLC carries other valuable items, as can be the case with custom channel
* types. In order to not modify this value, the client should set it zero.
*/
amtPaid: string;
}

/**
* Invoices is a service that can be used to create, accept, settle and cancel
* invoices.
Expand Down Expand Up @@ -162,10 +206,21 @@ export interface Invoices {
request?: DeepPartial<SettleInvoiceMsg>
): Promise<SettleInvoiceResp>;
/**
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be referenced
* using either its payment hash, payment address, or set ID.
*/
lookupInvoiceV2(request?: DeepPartial<LookupInvoiceMsg>): Promise<Invoice>;
/**
* HtlcModifier is a bidirectional streaming RPC that allows a client to
* intercept and modify the HTLCs that attempt to settle the given invoice. The
* server will send HTLCs of invoices to the client and the client can modify
* some aspects of the HTLC in order to pass the invoice acceptance tests.
*/
htlcModifier(
request?: DeepPartial<HtlcModifyResponse>,
onMessage?: (msg: HtlcModifyRequest) => void,
onError?: (err: Error) => void
): void;
}

type Builtin =
Expand Down
110 changes: 106 additions & 4 deletions lib/types/proto/lnd/lightning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,17 @@ export enum CommitmentType {
* channel before its maturity date.
*/
SCRIPT_ENFORCED_LEASE = 'SCRIPT_ENFORCED_LEASE',
/** SIMPLE_TAPROOT - TODO(roasbeef): need script enforce mirror type for the above as well? */
/**
* SIMPLE_TAPROOT - A channel that uses musig2 for the funding output, and the new tapscript
* features where relevant.
*/
SIMPLE_TAPROOT = 'SIMPLE_TAPROOT',
/**
* SIMPLE_TAPROOT_OVERLAY - Identical to the SIMPLE_TAPROOT channel type, but with extra functionality.
* This channel type also commits to additional meta data in the tapscript
* leaves for the scripts in a channel.
*/
SIMPLE_TAPROOT_OVERLAY = 'SIMPLE_TAPROOT_OVERLAY',
UNRECOGNIZED = 'UNRECOGNIZED'
}

Expand Down Expand Up @@ -164,6 +173,8 @@ export enum PaymentFailureReason {
FAILURE_REASON_INCORRECT_PAYMENT_DETAILS = 'FAILURE_REASON_INCORRECT_PAYMENT_DETAILS',
/** FAILURE_REASON_INSUFFICIENT_BALANCE - Insufficient local balance. */
FAILURE_REASON_INSUFFICIENT_BALANCE = 'FAILURE_REASON_INSUFFICIENT_BALANCE',
/** FAILURE_REASON_CANCELED - The payment was canceled. */
FAILURE_REASON_CANCELED = 'FAILURE_REASON_CANCELED',
UNRECOGNIZED = 'UNRECOGNIZED'
}

Expand Down Expand Up @@ -729,9 +740,8 @@ export interface SendCoinsRequest {
*/
satPerByte: string;
/**
* If set, then the amount field will be ignored, and lnd will attempt to
* send all the coins under control of the internal wallet to the specified
* address.
* If set, the amount field should be unset. It indicates lnd will send all
* wallet coins or all selected coins to the specified address.
*/
sendAll: boolean;
/** An optional label for the transaction, limited to 500 characters. */
Expand All @@ -745,6 +755,8 @@ export interface SendCoinsRequest {
spendUnconfirmed: boolean;
/** The strategy to use for selecting coins. */
coinSelectionStrategy: CoinSelectionStrategy;
/** A list of selected outpoints as inputs for the transaction. */
outpoints: OutPoint[];
}

export interface SendCoinsResponse {
Expand Down Expand Up @@ -1027,6 +1039,8 @@ export interface Channel {
* the channel's operation.
*/
memo: string;
/** Custom channel data that might be populated in custom channels. */
customChannelData: Uint8Array | string;
}

export interface ListChannelsRequest {
Expand Down Expand Up @@ -1356,9 +1370,39 @@ export interface ChannelOpenUpdate {
channelPoint: ChannelPoint | undefined;
}

export interface CloseOutput {
/**
* The amount in satoshi of this close output. This amount is the final
* commitment balance of the channel and the actual amount paid out on chain
* might be smaller due to subtracted fees.
*/
amountSat: string;
/** The pkScript of the close output. */
pkScript: Uint8Array | string;
/** Whether this output is for the local or remote node. */
isLocal: boolean;
/**
* The TLV encoded custom channel data records for this output, which might
* be set for custom channels.
*/
customChannelData: Uint8Array | string;
}

export interface ChannelCloseUpdate {
closingTxid: Uint8Array | string;
success: boolean;
/**
* The local channel close output. If the local channel balance was dust to
* begin with, this output will not be set.
*/
localCloseOutput: CloseOutput | undefined;
/**
* The remote channel close output. If the remote channel balance was dust
* to begin with, this output will not be set.
*/
remoteCloseOutput: CloseOutput | undefined;
/** Any additional outputs that might be added for custom channel types. */
additionalOutputs: CloseOutput[];
}

export interface CloseChannelRequest {
Expand Down Expand Up @@ -1991,6 +2035,8 @@ export interface PendingChannelsResponse_PendingChannel {
* impacts the channel's operation.
*/
memo: string;
/** Custom channel data that might be populated in custom channels. */
customChannelData: Uint8Array | string;
}

export interface PendingChannelsResponse_PendingOpenChannel {
Expand Down Expand Up @@ -2212,6 +2258,11 @@ export interface ChannelBalanceResponse {
pendingOpenLocalBalance: Amount | undefined;
/** Sum of channels pending remote balances. */
pendingOpenRemoteBalance: Amount | undefined;
/**
* Custom channel data that might be populated if there are custom channels
* present.
*/
customChannelData: Uint8Array | string;
}

export interface QueryRoutesRequest {
Expand Down Expand Up @@ -2666,6 +2717,11 @@ export interface ChanInfoRequest {
* output index for the channel.
*/
chanId: string;
/**
* The channel point of the channel in format funding_txid:output_index. If
* chan_id is specified, this field is ignored.
*/
chanPoint: string;
}

export interface NetworkInfoRequest {}
Expand Down Expand Up @@ -3006,6 +3062,17 @@ export interface Invoice {
* Note: Output only, don't specify for creating an invoice.
*/
ampInvoiceState: { [key: string]: AMPInvoiceState };
/**
* Signals that the invoice should include blinded paths to hide the true
* identity of the recipient.
*/
isBlinded: boolean;
/**
* Config values to use when creating blinded paths for this invoice. These
* can be used to override the defaults config values provided in by the
* global config. This field is only used if is_blinded is true.
*/
blindedPathConfig: BlindedPathConfig | undefined;
}

export enum Invoice_InvoiceState {
Expand All @@ -3026,6 +3093,30 @@ export interface Invoice_AmpInvoiceStateEntry {
value: AMPInvoiceState | undefined;
}

export interface BlindedPathConfig {
/**
* The minimum number of real hops to include in a blinded path. This doesn't
* include our node, so if the minimum is 1, then the path will contain at
* minimum our node along with an introduction node hop. If it is zero then
* the shortest path will use our node as an introduction node.
*/
minNumRealHops?: number | undefined;
/**
* The number of hops to include in a blinded path. This doesn't include our
* node, so if it is 1, then the path will contain our node along with an
* introduction node or dummy node hop. If paths shorter than NumHops is
* found, then they will be padded using dummy hops.
*/
numHops?: number | undefined;
/** The maximum number of blinded paths to select and add to an invoice. */
maxNumPaths?: number | undefined;
/**
* A list of node IDs of nodes that should not be used in any of our generated
* blinded paths.
*/
nodeOmissionList: Uint8Array | string[];
}

/** Details of an HTLC that paid to an invoice */
export interface InvoiceHTLC {
/** Short channel id over which the htlc was received. */
Expand All @@ -3050,13 +3141,23 @@ export interface InvoiceHTLC {
mppTotalAmtMsat: string;
/** Details relevant to AMP HTLCs, only populated if this is an AMP HTLC. */
amp: AMP | undefined;
/**
* Custom tlv records that were only sent on the p2p wire message, not in
* the onion.
*/
wireCustomRecords: { [key: string]: Uint8Array | string };
}

export interface InvoiceHTLC_CustomRecordsEntry {
key: string;
value: Uint8Array | string;
}

export interface InvoiceHTLC_WireCustomRecordsEntry {
key: string;
value: Uint8Array | string;
}

/** Details specific to AMP HTLCs. */
export interface AMP {
/**
Expand Down Expand Up @@ -3408,6 +3509,7 @@ export interface PayReq {
paymentAddr: Uint8Array | string;
numMsat: string;
features: { [key: number]: Feature };
blindedPaths: BlindedPaymentPath[];
}

export interface PayReq_FeaturesEntry {
Expand Down
Loading

0 comments on commit ce854ee

Please sign in to comment.