@@ -1551,21 +1551,20 @@ typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1551
1551
1552
1552
1553
1553
/**
1554
- * An event to be processed by the ChannelManager.
1554
+ * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1555
+ * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1556
+ * preimage claim backward will lead to loss of funds.
1557
+ *
1558
+ * [`chain::Watch`]: ../trait.Watch.html
1555
1559
*/
1556
- typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1560
+ typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1557
1561
/**
1558
1562
* Nearly everywhere, inner must be non-null, however in places where
1559
1563
* the Rust equivalent takes an Option, it may be set to null to indicate None.
1560
1564
*/
1561
- LDKnativeMonitorEvent * inner ;
1565
+ LDKnativeHTLCUpdate * inner ;
1562
1566
bool is_owned ;
1563
- } LDKMonitorEvent ;
1564
-
1565
- typedef struct LDKCVec_MonitorEventZ {
1566
- struct LDKMonitorEvent * data ;
1567
- uintptr_t datalen ;
1568
- } LDKCVec_MonitorEventZ ;
1567
+ } LDKHTLCUpdate ;
1569
1568
1570
1569
1571
1570
@@ -1584,22 +1583,150 @@ typedef struct MUST_USE_STRUCT LDKOutPoint {
1584
1583
bool is_owned ;
1585
1584
} LDKOutPoint ;
1586
1585
1586
+ /**
1587
+ * An event to be processed by the ChannelManager.
1588
+ */
1589
+ typedef enum LDKMonitorEvent_Tag {
1590
+ /**
1591
+ * A monitor event containing an HTLCUpdate.
1592
+ */
1593
+ LDKMonitorEvent_HTLCEvent ,
1594
+ /**
1595
+ * A monitor event that the Channel's commitment transaction was broadcasted.
1596
+ */
1597
+ LDKMonitorEvent_CommitmentTxBroadcasted ,
1598
+ /**
1599
+ * Must be last for serialization purposes
1600
+ */
1601
+ LDKMonitorEvent_Sentinel ,
1602
+ } LDKMonitorEvent_Tag ;
1603
+
1604
+ typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1605
+ LDKMonitorEvent_Tag tag ;
1606
+ union {
1607
+ struct {
1608
+ struct LDKHTLCUpdate htlc_event ;
1609
+ };
1610
+ struct {
1611
+ struct LDKOutPoint commitment_tx_broadcasted ;
1612
+ };
1613
+ };
1614
+ } LDKMonitorEvent ;
1615
+
1616
+ typedef struct LDKCVec_MonitorEventZ {
1617
+ struct LDKMonitorEvent * data ;
1618
+ uintptr_t datalen ;
1619
+ } LDKCVec_MonitorEventZ ;
1620
+
1621
+
1622
+
1623
+ /**
1624
+ * Information about a spendable output to a P2WSH script. See
1625
+ * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
1626
+ */
1627
+ typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1628
+ /**
1629
+ * Nearly everywhere, inner must be non-null, however in places where
1630
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
1631
+ */
1632
+ LDKnativeDelayedPaymentOutputDescriptor * inner ;
1633
+ bool is_owned ;
1634
+ } LDKDelayedPaymentOutputDescriptor ;
1635
+
1587
1636
1588
1637
1638
+ /**
1639
+ * Information about a spendable output to our \"payment key\". See
1640
+ * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
1641
+ */
1642
+ typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1643
+ /**
1644
+ * Nearly everywhere, inner must be non-null, however in places where
1645
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
1646
+ */
1647
+ LDKnativeStaticPaymentOutputDescriptor * inner ;
1648
+ bool is_owned ;
1649
+ } LDKStaticPaymentOutputDescriptor ;
1650
+
1589
1651
/**
1590
1652
* When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1591
1653
* claim at any point in the future) an event is generated which you must track and be able to
1592
1654
* spend on-chain. The information needed to do this is provided in this enum, including the
1593
1655
* outpoint describing which txid and output index is available, the full output which exists at
1594
1656
* that txid/index, and any keys or other information required to sign.
1595
1657
*/
1596
- typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1658
+ typedef enum LDKSpendableOutputDescriptor_Tag {
1597
1659
/**
1598
- * Nearly everywhere, inner must be non-null, however in places where
1599
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
1660
+ * An output to a script which was provided via KeysInterface directly, either from
1661
+ * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
1662
+ * spend it. No secret keys are provided as rust-lightning was never given any key.
1663
+ * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1664
+ * on-chain using the payment preimage or after it has timed out.
1600
1665
*/
1601
- LDKnativeSpendableOutputDescriptor * inner ;
1602
- bool is_owned ;
1666
+ LDKSpendableOutputDescriptor_StaticOutput ,
1667
+ /**
1668
+ * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1669
+ *
1670
+ * The witness in the spending input should be:
1671
+ * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1672
+ *
1673
+ * Note that the nSequence field in the spending input must be set to to_self_delay
1674
+ * (which means the transaction is not broadcastable until at least to_self_delay
1675
+ * blocks after the outpoint confirms).
1676
+ *
1677
+ * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1678
+ * it is an output from an old state which we broadcast (which should never happen).
1679
+ *
1680
+ * To derive the delayed_payment key which is used to sign for this input, you must pass the
1681
+ * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1682
+ * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1683
+ * chan_utils::derive_private_key. The public key can be generated without the secret key
1684
+ * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1685
+ * ChannelKeys::pubkeys().
1686
+ *
1687
+ * To derive the revocation_pubkey provided here (which is used in the witness
1688
+ * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1689
+ * call to ChannelKeys::ready_channel) and the provided per_commitment point
1690
+ * to chan_utils::derive_public_revocation_key.
1691
+ *
1692
+ * The witness script which is hashed and included in the output script_pubkey may be
1693
+ * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1694
+ * (derived as above), and the to_self_delay contained here to
1695
+ * chan_utils::get_revokeable_redeemscript.
1696
+ */
1697
+ LDKSpendableOutputDescriptor_DelayedPaymentOutput ,
1698
+ /**
1699
+ * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1700
+ * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
1701
+ * The witness in the spending input, is, thus, simply:
1702
+ * <BIP 143 signature> <payment key>
1703
+ *
1704
+ * These are generally the result of our counterparty having broadcast the current state,
1705
+ * allowing us to claim the non-HTLC-encumbered outputs immediately.
1706
+ */
1707
+ LDKSpendableOutputDescriptor_StaticPaymentOutput ,
1708
+ /**
1709
+ * Must be last for serialization purposes
1710
+ */
1711
+ LDKSpendableOutputDescriptor_Sentinel ,
1712
+ } LDKSpendableOutputDescriptor_Tag ;
1713
+
1714
+ typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1715
+ struct LDKOutPoint outpoint ;
1716
+ struct LDKTxOut output ;
1717
+ } LDKSpendableOutputDescriptor_LDKStaticOutput_Body ;
1718
+
1719
+ typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1720
+ LDKSpendableOutputDescriptor_Tag tag ;
1721
+ union {
1722
+ LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output ;
1723
+ struct {
1724
+ struct LDKDelayedPaymentOutputDescriptor delayed_payment_output ;
1725
+ };
1726
+ struct {
1727
+ struct LDKStaticPaymentOutputDescriptor static_payment_output ;
1728
+ };
1729
+ };
1603
1730
} LDKSpendableOutputDescriptor ;
1604
1731
1605
1732
typedef struct LDKCVec_SpendableOutputDescriptorZ {
@@ -1762,24 +1889,6 @@ typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
1762
1889
bool result_ok ;
1763
1890
} LDKCResult_ChannelMonitorUpdateDecodeErrorZ ;
1764
1891
1765
-
1766
-
1767
- /**
1768
- * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1769
- * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1770
- * preimage claim backward will lead to loss of funds.
1771
- *
1772
- * [`chain::Watch`]: ../trait.Watch.html
1773
- */
1774
- typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1775
- /**
1776
- * Nearly everywhere, inner must be non-null, however in places where
1777
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
1778
- */
1779
- LDKnativeHTLCUpdate * inner ;
1780
- bool is_owned ;
1781
- } LDKHTLCUpdate ;
1782
-
1783
1892
typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
1784
1893
struct LDKHTLCUpdate * result ;
1785
1894
struct LDKDecodeError * err ;
@@ -2186,6 +2295,16 @@ typedef struct LDKCResult_NoneAPIErrorZ {
2186
2295
bool result_ok ;
2187
2296
} LDKCResult_NoneAPIErrorZ ;
2188
2297
2298
+ typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
2299
+ struct LDKCResult_NoneAPIErrorZ * data ;
2300
+ uintptr_t datalen ;
2301
+ } LDKCVec_CResult_NoneAPIErrorZZ ;
2302
+
2303
+ typedef struct LDKCVec_APIErrorZ {
2304
+ struct LDKAPIError * data ;
2305
+ uintptr_t datalen ;
2306
+ } LDKCVec_APIErrorZ ;
2307
+
2189
2308
2190
2309
2191
2310
/**
@@ -2205,20 +2324,71 @@ typedef struct LDKCVec_ChannelDetailsZ {
2205
2324
uintptr_t datalen ;
2206
2325
} LDKCVec_ChannelDetailsZ ;
2207
2326
2208
-
2209
-
2210
2327
/**
2211
2328
* If a payment fails to send, it can be in one of several states. This enum is returned as the
2212
2329
* Err() type describing which state the payment is in, see the description of individual enum
2213
2330
* states for more.
2214
2331
*/
2215
- typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
2332
+ typedef enum LDKPaymentSendFailure_Tag {
2216
2333
/**
2217
- * Nearly everywhere, inner must be non-null, however in places where
2218
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
2334
+ * A parameter which was passed to send_payment was invalid, preventing us from attempting to
2335
+ * send the payment at all. No channel state has been changed or messages sent to peers, and
2336
+ * once you've changed the parameter at error, you can freely retry the payment in full.
2219
2337
*/
2220
- LDKnativePaymentSendFailure * inner ;
2221
- bool is_owned ;
2338
+ LDKPaymentSendFailure_ParameterError ,
2339
+ /**
2340
+ * A parameter in a single path which was passed to send_payment was invalid, preventing us
2341
+ * from attempting to send the payment at all. No channel state has been changed or messages
2342
+ * sent to peers, and once you've changed the parameter at error, you can freely retry the
2343
+ * payment in full.
2344
+ *
2345
+ * The results here are ordered the same as the paths in the route object which was passed to
2346
+ * send_payment.
2347
+ */
2348
+ LDKPaymentSendFailure_PathParameterError ,
2349
+ /**
2350
+ * All paths which were attempted failed to send, with no channel state change taking place.
2351
+ * You can freely retry the payment in full (though you probably want to do so over different
2352
+ * paths than the ones selected).
2353
+ */
2354
+ LDKPaymentSendFailure_AllFailedRetrySafe ,
2355
+ /**
2356
+ * Some paths which were attempted failed to send, though possibly not all. At least some
2357
+ * paths have irrevocably committed to the HTLC and retrying the payment in full would result
2358
+ * in over-/re-payment.
2359
+ *
2360
+ * The results here are ordered the same as the paths in the route object which was passed to
2361
+ * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
2362
+ * retried (though there is currently no API with which to do so).
2363
+ *
2364
+ * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
2365
+ * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
2366
+ * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
2367
+ * with the latest update_id.
2368
+ */
2369
+ LDKPaymentSendFailure_PartialFailure ,
2370
+ /**
2371
+ * Must be last for serialization purposes
2372
+ */
2373
+ LDKPaymentSendFailure_Sentinel ,
2374
+ } LDKPaymentSendFailure_Tag ;
2375
+
2376
+ typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
2377
+ LDKPaymentSendFailure_Tag tag ;
2378
+ union {
2379
+ struct {
2380
+ struct LDKAPIError parameter_error ;
2381
+ };
2382
+ struct {
2383
+ struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error ;
2384
+ };
2385
+ struct {
2386
+ struct LDKCVec_APIErrorZ all_failed_retry_safe ;
2387
+ };
2388
+ struct {
2389
+ struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure ;
2390
+ };
2391
+ };
2222
2392
} LDKPaymentSendFailure ;
2223
2393
2224
2394
typedef union LDKCResult_NonePaymentSendFailureZPtr {
@@ -3406,36 +3576,6 @@ typedef struct MUST_USE_STRUCT LDKChainMonitor {
3406
3576
3407
3577
3408
3578
3409
- /**
3410
- * Information about a spendable output to a P2WSH script. See
3411
- * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
3412
- */
3413
- typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
3414
- /**
3415
- * Nearly everywhere, inner must be non-null, however in places where
3416
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
3417
- */
3418
- LDKnativeDelayedPaymentOutputDescriptor * inner ;
3419
- bool is_owned ;
3420
- } LDKDelayedPaymentOutputDescriptor ;
3421
-
3422
-
3423
-
3424
- /**
3425
- * Information about a spendable output to our \"payment key\". See
3426
- * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
3427
- */
3428
- typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
3429
- /**
3430
- * Nearly everywhere, inner must be non-null, however in places where
3431
- * the Rust equivalent takes an Option, it may be set to null to indicate None.
3432
- */
3433
- LDKnativeStaticPaymentOutputDescriptor * inner ;
3434
- bool is_owned ;
3435
- } LDKStaticPaymentOutputDescriptor ;
3436
-
3437
-
3438
-
3439
3579
/**
3440
3580
* Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
3441
3581
* and derives keys from that.
@@ -4144,6 +4284,10 @@ void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
4144
4284
4145
4285
struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone (const struct LDKCResult_NoneAPIErrorZ * NONNULL_PTR orig );
4146
4286
4287
+ void CVec_CResult_NoneAPIErrorZZ_free (struct LDKCVec_CResult_NoneAPIErrorZZ _res );
4288
+
4289
+ void CVec_APIErrorZ_free (struct LDKCVec_APIErrorZ _res );
4290
+
4147
4291
void CVec_ChannelDetailsZ_free (struct LDKCVec_ChannelDetailsZ _res );
4148
4292
4149
4293
struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok (void );
0 commit comments