Update CI references to 0.0.111
[ldk-java] / ts / structs / ProbabilisticScoringParameters.mts
index 9555b1eb1d7348f6b9382464bd1f6c4ef5bc60b3..5cd76b4ff730766f357ce45c263f12eeec3ee411 100644 (file)
@@ -67,6 +67,9 @@ import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurp
 import { ClosureReason } from '../structs/ClosureReason.mjs';
 import { Option_ClosureReasonZ } from '../structs/Option_ClosureReasonZ.mjs';
 import { Result_COption_ClosureReasonZDecodeErrorZ } from '../structs/Result_COption_ClosureReasonZDecodeErrorZ.mjs';
+import { HTLCDestination } from '../structs/HTLCDestination.mjs';
+import { Option_HTLCDestinationZ } from '../structs/Option_HTLCDestinationZ.mjs';
+import { Result_COption_HTLCDestinationZDecodeErrorZ } from '../structs/Result_COption_HTLCDestinationZDecodeErrorZ.mjs';
 import { ChannelUpdate } from '../structs/ChannelUpdate.mjs';
 import { NetworkUpdate } from '../structs/NetworkUpdate.mjs';
 import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs';
@@ -104,10 +107,13 @@ import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransaction
 import { Result_NoneChannelMonitorUpdateErrZ } from '../structs/Result_NoneChannelMonitorUpdateErrZ.mjs';
 import { HTLCUpdate } from '../structs/HTLCUpdate.mjs';
 import { MonitorEvent } from '../structs/MonitorEvent.mjs';
-import { TwoTuple_OutPointCVec_MonitorEventZZ } from '../structs/TwoTuple_OutPointCVec_MonitorEventZZ.mjs';
+import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.mjs';
 import { Option_C2Tuple_usizeTransactionZZ } from '../structs/Option_C2Tuple_usizeTransactionZZ.mjs';
 import { FixedPenaltyScorer } from '../structs/FixedPenaltyScorer.mjs';
 import { Result_FixedPenaltyScorerDecodeErrorZ } from '../structs/Result_FixedPenaltyScorerDecodeErrorZ.mjs';
+import { TwoTuple_u64u64Z } from '../structs/TwoTuple_u64u64Z.mjs';
+import { Option_C2Tuple_u64u64ZZ } from '../structs/Option_C2Tuple_u64u64ZZ.mjs';
+import { NodeId } from '../structs/NodeId.mjs';
 import { Record } from '../structs/Record.mjs';
 import { Logger, LoggerInterface } from '../structs/Logger.mjs';
 import { NetworkGraph } from '../structs/NetworkGraph.mjs';
@@ -122,7 +128,6 @@ import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesD
 import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs';
 import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs';
 import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs';
-import { NodeId } from '../structs/NodeId.mjs';
 import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs';
 import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs';
 import { Access, AccessInterface } from '../structs/Access.mjs';
@@ -136,9 +141,12 @@ import { ChannelInfo } from '../structs/ChannelInfo.mjs';
 import { Result_ChannelInfoDecodeErrorZ } from '../structs/Result_ChannelInfoDecodeErrorZ.mjs';
 import { RoutingFees } from '../structs/RoutingFees.mjs';
 import { Result_RoutingFeesDecodeErrorZ } from '../structs/Result_RoutingFeesDecodeErrorZ.mjs';
+import { Hostname } from '../structs/Hostname.mjs';
 import { NetAddress } from '../structs/NetAddress.mjs';
 import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs';
 import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs';
+import { NodeAlias } from '../structs/NodeAlias.mjs';
+import { Result_NodeAliasDecodeErrorZ } from '../structs/Result_NodeAliasDecodeErrorZ.mjs';
 import { NodeInfo } from '../structs/NodeInfo.mjs';
 import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs';
 import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs';
@@ -353,10 +361,13 @@ import * as bindings from '../bindings.mjs'
  * 
  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
+ * 
+ * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
+ * parameters here.
  */
 export class ProbabilisticScoringParameters extends CommonBase {
        /* @internal */
-       public constructor(_dummy: object, ptr: number) {
+       public constructor(_dummy: object, ptr: bigint) {
                super(ptr, bindings.ProbabilisticScoringParameters_free);
        }
 
@@ -379,6 +390,43 @@ export class ProbabilisticScoringParameters extends CommonBase {
                bindings.ProbabilisticScoringParameters_set_base_penalty_msat(this.ptr, val);
        }
 
+       /**
+        * A multiplier used with the payment amount to calculate a fixed penalty applied to each
+        * channel, in excess of the [`base_penalty_msat`].
+        * 
+        * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
+        * fees plus penalty) for large payments. The penalty is computed as the product of this
+        * multiplier and `2^30`ths of the payment amount.
+        * 
+        * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
+        * 
+        * Default value: 8,192 msat
+        * 
+        * [`base_penalty_msat`]: Self::base_penalty_msat
+        */
+       public get_base_penalty_amount_multiplier_msat(): bigint {
+               const ret: bigint = bindings.ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(this.ptr);
+               return ret;
+       }
+
+       /**
+        * A multiplier used with the payment amount to calculate a fixed penalty applied to each
+        * channel, in excess of the [`base_penalty_msat`].
+        * 
+        * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
+        * fees plus penalty) for large payments. The penalty is computed as the product of this
+        * multiplier and `2^30`ths of the payment amount.
+        * 
+        * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
+        * 
+        * Default value: 8,192 msat
+        * 
+        * [`base_penalty_msat`]: Self::base_penalty_msat
+        */
+       public set_base_penalty_amount_multiplier_msat(val: bigint): void {
+               bindings.ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(this.ptr, val);
+       }
+
        /**
         * A multiplier used in conjunction with the negative `log10` of the channel's success
         * probability for a payment to determine the liquidity penalty.
@@ -466,7 +514,7 @@ export class ProbabilisticScoringParameters extends CommonBase {
         * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
         * success probability.
         * 
-        * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
+        * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
         * 
         * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
         * the amount will result in a penalty of the multiplier. And, as the success probability
@@ -476,8 +524,8 @@ export class ProbabilisticScoringParameters extends CommonBase {
         * 
         * Default value: 256 msat
         */
-       public get_amount_penalty_multiplier_msat(): bigint {
-               const ret: bigint = bindings.ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(this.ptr);
+       public get_liquidity_penalty_amount_multiplier_msat(): bigint {
+               const ret: bigint = bindings.ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(this.ptr);
                return ret;
        }
 
@@ -490,7 +538,7 @@ export class ProbabilisticScoringParameters extends CommonBase {
         * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
         * success probability.
         * 
-        * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
+        * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
         * 
         * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
         * the amount will result in a penalty of the multiplier. And, as the success probability
@@ -500,22 +548,84 @@ export class ProbabilisticScoringParameters extends CommonBase {
         * 
         * Default value: 256 msat
         */
-       public set_amount_penalty_multiplier_msat(val: bigint): void {
-               bindings.ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(this.ptr, val);
+       public set_liquidity_penalty_amount_multiplier_msat(val: bigint): void {
+               bindings.ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(this.ptr, val);
        }
 
        /**
-        * Constructs a new ProbabilisticScoringParameters given each field
+        * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
+        * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
+        * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
+        * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
+        * 
+        * Default value: 250 msat
         */
-       public static constructor_new(base_penalty_msat_arg: bigint, liquidity_penalty_multiplier_msat_arg: bigint, liquidity_offset_half_life_arg: bigint, amount_penalty_multiplier_msat_arg: bigint): ProbabilisticScoringParameters {
-               const ret: number = bindings.ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg);
-               const ret_hu_conv: ProbabilisticScoringParameters = new ProbabilisticScoringParameters(null, ret);
-               CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
-               return ret_hu_conv;
+       public get_anti_probing_penalty_msat(): bigint {
+               const ret: bigint = bindings.ProbabilisticScoringParameters_get_anti_probing_penalty_msat(this.ptr);
+               return ret;
        }
 
-       public clone_ptr(): number {
-               const ret: number = bindings.ProbabilisticScoringParameters_clone_ptr(this.ptr);
+       /**
+        * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
+        * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
+        * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
+        * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
+        * 
+        * Default value: 250 msat
+        */
+       public set_anti_probing_penalty_msat(val: bigint): void {
+               bindings.ProbabilisticScoringParameters_set_anti_probing_penalty_msat(this.ptr, val);
+       }
+
+       /**
+        * This penalty is applied when the amount we're attempting to send over a channel exceeds our
+        * current estimate of the channel's available liquidity.
+        * 
+        * Note that in this case all other penalties, including the
+        * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
+        * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
+        * applicable, are still included in the overall penalty.
+        * 
+        * If you wish to avoid creating paths with such channels entirely, setting this to a value of
+        * `u64::max_value()` will guarantee that.
+        * 
+        * Default value: 1_0000_0000_000 msat (1 Bitcoin)
+        * 
+        * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
+        * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
+        * [`base_penalty_msat`]: Self::base_penalty_msat
+        * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
+        */
+       public get_considered_impossible_penalty_msat(): bigint {
+               const ret: bigint = bindings.ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(this.ptr);
+               return ret;
+       }
+
+       /**
+        * This penalty is applied when the amount we're attempting to send over a channel exceeds our
+        * current estimate of the channel's available liquidity.
+        * 
+        * Note that in this case all other penalties, including the
+        * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
+        * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
+        * applicable, are still included in the overall penalty.
+        * 
+        * If you wish to avoid creating paths with such channels entirely, setting this to a value of
+        * `u64::max_value()` will guarantee that.
+        * 
+        * Default value: 1_0000_0000_000 msat (1 Bitcoin)
+        * 
+        * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
+        * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
+        * [`base_penalty_msat`]: Self::base_penalty_msat
+        * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
+        */
+       public set_considered_impossible_penalty_msat(val: bigint): void {
+               bindings.ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(this.ptr, val);
+       }
+
+       public clone_ptr(): bigint {
+               const ret: bigint = bindings.ProbabilisticScoringParameters_clone_ptr(this.ptr);
                return ret;
        }
 
@@ -523,17 +633,26 @@ export class ProbabilisticScoringParameters extends CommonBase {
         * Creates a copy of the ProbabilisticScoringParameters
         */
        public clone(): ProbabilisticScoringParameters {
-               const ret: number = bindings.ProbabilisticScoringParameters_clone(this.ptr);
+               const ret: bigint = bindings.ProbabilisticScoringParameters_clone(this.ptr);
                const ret_hu_conv: ProbabilisticScoringParameters = new ProbabilisticScoringParameters(null, ret);
                CommonBase.add_ref_from(ret_hu_conv, this);
                return ret_hu_conv;
        }
 
+       /**
+        * Marks all nodes in the given list as banned, i.e.,
+        * they will be avoided during path finding.
+        */
+       public add_banned_from_list(node_ids: NodeId[]): void {
+               bindings.ProbabilisticScoringParameters_add_banned_from_list(this.ptr, bindings.encodeUint64Array(node_ids != null ? node_ids.map(node_ids_conv_8 => node_ids_conv_8 == null ? 0n : CommonBase.get_ptr_of(node_ids_conv_8)) : null));
+               node_ids.forEach((node_ids_conv_8: NodeId) => { CommonBase.add_ref_from(this, node_ids_conv_8); });
+       }
+
        /**
         * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
         */
        public static constructor_default(): ProbabilisticScoringParameters {
-               const ret: number = bindings.ProbabilisticScoringParameters_default();
+               const ret: bigint = bindings.ProbabilisticScoringParameters_default();
                const ret_hu_conv: ProbabilisticScoringParameters = new ProbabilisticScoringParameters(null, ret);
                CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
                return ret_hu_conv;