Skip to content

Commit e9d819d

Browse files
committed
Update auto-generated bindings
1 parent 7dbced3 commit e9d819d

File tree

4 files changed

+131
-161
lines changed

4 files changed

+131
-161
lines changed

lightning-c-bindings/include/lightning.h

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,13 @@ typedef struct LDKPublicKey {
241241
uint8_t compressed_form[33];
242242
} LDKPublicKey;
243243

244-
typedef struct LDKC2Tuple_u64u64Z {
245-
uint64_t a;
246-
uint64_t b;
247-
} LDKC2Tuple_u64u64Z;
244+
/**
245+
* Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
246+
* look up the corresponding function in rust-lightning's docs.
247+
*/
248+
typedef struct LDKThirtyTwoBytes {
249+
uint8_t data[32];
250+
} LDKThirtyTwoBytes;
248251

249252
/**
250253
* When on-chain outputs are created by rust-lightning (which our counterparty is not able to
@@ -255,9 +258,9 @@ typedef struct LDKC2Tuple_u64u64Z {
255258
*/
256259
typedef enum LDKSpendableOutputDescriptor_Tag {
257260
/**
258-
* An output to a script which was provided via KeysInterface, thus you should already know
259-
* how to spend it. No keys are provided as rust-lightning was never given any keys - only the
260-
* script_pubkey as it appears in the output.
261+
* An output to a script which was provided via KeysInterface directly, either from
262+
* `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
263+
* spend it. No secret keys are provided as rust-lightning was never given any key.
261264
* These may include outputs from a transaction punishing our counterparty or claiming an HTLC
262265
* on-chain using the payment preimage or after it has timed out.
263266
*/
@@ -319,14 +322,16 @@ typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
319322
struct LDKPublicKey per_commitment_point;
320323
uint16_t to_self_delay;
321324
struct LDKTxOut output;
322-
struct LDKC2Tuple_u64u64Z key_derivation_params;
323325
struct LDKPublicKey revocation_pubkey;
326+
struct LDKThirtyTwoBytes channel_keys_id;
327+
uint64_t channel_value_satoshis;
324328
} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
325329

326330
typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
327331
struct LDKOutPoint outpoint;
328332
struct LDKTxOut output;
329-
struct LDKC2Tuple_u64u64Z key_derivation_params;
333+
struct LDKThirtyTwoBytes channel_keys_id;
334+
uint64_t channel_value_satoshis;
330335
} LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
331336

332337
typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
@@ -889,14 +894,6 @@ typedef struct LDKCVec_MessageSendEventZ {
889894
uintptr_t datalen;
890895
} LDKCVec_MessageSendEventZ;
891896

892-
/**
893-
* Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
894-
* look up the corresponding function in rust-lightning's docs.
895-
*/
896-
typedef struct LDKThirtyTwoBytes {
897-
uint8_t data[32];
898-
} LDKThirtyTwoBytes;
899-
900897
/**
901898
* An Event which you should probably take some action in response to.
902899
*
@@ -1349,11 +1346,11 @@ typedef struct LDKChannelKeys {
13491346
*/
13501347
void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
13511348
/**
1352-
* Gets arbitrary identifiers describing the set of keys which are provided back to you in
1353-
* some SpendableOutputDescriptor types. These should be sufficient to identify this
1349+
* Gets an arbitrary identifier describing the set of keys which are provided back to you in
1350+
* some SpendableOutputDescriptor types. This should be sufficient to identify this
13541351
* ChannelKeys object uniquely and lookup or re-derive its keys.
13551352
*/
1356-
struct LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1353+
struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
13571354
/**
13581355
* Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
13591356
*
@@ -1849,26 +1846,39 @@ typedef struct LDKu8slice {
18491846
typedef struct LDKKeysInterface {
18501847
void *this_arg;
18511848
/**
1852-
* Get node secret key (aka node_id or network_key)
1849+
* Get node secret key (aka node_id or network_key).
1850+
*
1851+
* This method must return the same value each time it is called.
18531852
*/
18541853
struct LDKSecretKey (*get_node_secret)(const void *this_arg);
18551854
/**
1856-
* Get destination redeemScript to encumber static protocol exit points.
1855+
* Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
1856+
*
1857+
* This method should return a different value each time it is called, to avoid linking
1858+
* on-chain funds across channels as controlled to the same user.
18571859
*/
18581860
struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
18591861
/**
1860-
* Get shutdown_pubkey to use as PublicKey at channel closure
1862+
* Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
1863+
* a channel.
1864+
*
1865+
* This method should return a different value each time it is called, to avoid linking
1866+
* on-chain funds across channels as controlled to the same user.
18611867
*/
18621868
struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
18631869
/**
18641870
* Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
18651871
* restarted with some stale data!
1872+
*
1873+
* This method must return a different value each time it is called.
18661874
*/
18671875
struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
18681876
/**
18691877
* Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
18701878
* onion packets and for temporary channel IDs. There is no requirement that these be
18711879
* persisted anywhere, though they must be unique across restarts.
1880+
*
1881+
* This method must return a different value each time it is called.
18721882
*/
18731883
struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
18741884
/**
@@ -3548,12 +3558,6 @@ struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_B
35483558

35493559
void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
35503560

3551-
struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
3552-
3553-
struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3554-
3555-
void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
3556-
35573561
struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
35583562

35593563
struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
@@ -4686,7 +4690,7 @@ void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONN
46864690
/**
46874691
* Create a new InMemoryChannelKeys
46884692
*/
4689-
MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKC2Tuple_u64u64Z key_derivation_params);
4693+
MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
46904694

46914695
/**
46924696
* Counterparty pubkeys.
@@ -4765,10 +4769,10 @@ MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], en
47654769
* Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
47664770
* parameters.
47674771
* Key derivation parameters are accessible through a per-channel secrets
4768-
* ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
4772+
* ChannelKeys::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
47694773
* onchain output detection for which a corresponding delayed_payment_key must be derived.
47704774
*/
4771-
MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2);
4775+
MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]);
47724776

47734777
struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
47744778

lightning-c-bindings/include/lightningpp.hpp

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,21 +2096,6 @@ class CVec_PublicKeyZ {
20962096
const LDKCVec_PublicKeyZ* operator &() const { return &self; }
20972097
const LDKCVec_PublicKeyZ* operator ->() const { return &self; }
20982098
};
2099-
class C2Tuple_u64u64Z {
2100-
private:
2101-
LDKC2Tuple_u64u64Z self;
2102-
public:
2103-
C2Tuple_u64u64Z(const C2Tuple_u64u64Z&) = delete;
2104-
C2Tuple_u64u64Z(C2Tuple_u64u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u64u64Z)); }
2105-
C2Tuple_u64u64Z(LDKC2Tuple_u64u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u64u64Z)); }
2106-
operator LDKC2Tuple_u64u64Z() && { LDKC2Tuple_u64u64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_u64u64Z)); return res; }
2107-
~C2Tuple_u64u64Z() { C2Tuple_u64u64Z_free(self); }
2108-
C2Tuple_u64u64Z& operator=(C2Tuple_u64u64Z&& o) { C2Tuple_u64u64Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u64u64Z)); return *this; }
2109-
LDKC2Tuple_u64u64Z* operator &() { return &self; }
2110-
LDKC2Tuple_u64u64Z* operator ->() { return &self; }
2111-
const LDKC2Tuple_u64u64Z* operator &() const { return &self; }
2112-
const LDKC2Tuple_u64u64Z* operator ->() const { return &self; }
2113-
};
21142099
class C2Tuple_u32TxOutZ {
21152100
private:
21162101
LDKC2Tuple_u32TxOutZ self;
@@ -2576,20 +2561,20 @@ class CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
25762561
const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator &() const { return &self; }
25772562
const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator ->() const { return &self; }
25782563
};
2579-
class CVec_UpdateFailHTLCZ {
2564+
class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
25802565
private:
2581-
LDKCVec_UpdateFailHTLCZ self;
2566+
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self;
25822567
public:
2583-
CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete;
2584-
CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); }
2585-
CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); }
2586-
operator LDKCVec_UpdateFailHTLCZ() && { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; }
2587-
~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); }
2588-
CVec_UpdateFailHTLCZ& operator=(CVec_UpdateFailHTLCZ&& o) { CVec_UpdateFailHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); return *this; }
2589-
LDKCVec_UpdateFailHTLCZ* operator &() { return &self; }
2590-
LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; }
2591-
const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; }
2592-
const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; }
2568+
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete;
2569+
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
2570+
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
2571+
operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; }
2572+
~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); }
2573+
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; }
2574+
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; }
2575+
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; }
2576+
const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; }
2577+
const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; }
25932578
};
25942579
class C2Tuple_OutPointScriptZ {
25952580
private:
@@ -2621,20 +2606,20 @@ class CResult_InMemoryChannelKeysDecodeErrorZ {
26212606
const LDKCResult_InMemoryChannelKeysDecodeErrorZ* operator &() const { return &self; }
26222607
const LDKCResult_InMemoryChannelKeysDecodeErrorZ* operator ->() const { return &self; }
26232608
};
2624-
class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2609+
class CVec_UpdateFailHTLCZ {
26252610
private:
2626-
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self;
2611+
LDKCVec_UpdateFailHTLCZ self;
26272612
public:
2628-
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete;
2629-
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
2630-
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); }
2631-
operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; }
2632-
~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); }
2633-
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; }
2634-
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; }
2635-
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; }
2636-
const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; }
2637-
const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; }
2613+
CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete;
2614+
CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); }
2615+
CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); }
2616+
operator LDKCVec_UpdateFailHTLCZ() && { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; }
2617+
~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); }
2618+
CVec_UpdateFailHTLCZ& operator=(CVec_UpdateFailHTLCZ&& o) { CVec_UpdateFailHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); return *this; }
2619+
LDKCVec_UpdateFailHTLCZ* operator &() { return &self; }
2620+
LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; }
2621+
const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; }
2622+
const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; }
26382623
};
26392624
class CResult_RouteDecodeErrorZ {
26402625
private:

lightning-c-bindings/src/c_types/derived.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -711,41 +711,6 @@ impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHas
711711
}
712712
}
713713
#[repr(C)]
714-
pub struct C2Tuple_u64u64Z {
715-
pub a: u64,
716-
pub b: u64,
717-
}
718-
impl From<(u64, u64)> for C2Tuple_u64u64Z {
719-
fn from (tup: (u64, u64)) -> Self {
720-
Self {
721-
a: tup.0,
722-
b: tup.1,
723-
}
724-
}
725-
}
726-
impl C2Tuple_u64u64Z {
727-
#[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
728-
(self.a, self.b)
729-
}
730-
}
731-
impl Clone for C2Tuple_u64u64Z {
732-
fn clone(&self) -> Self {
733-
Self {
734-
a: self.a.clone(),
735-
b: self.b.clone(),
736-
}
737-
}
738-
}
739-
#[no_mangle]
740-
pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { orig.clone() }
741-
#[no_mangle]
742-
pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
743-
C2Tuple_u64u64Z { a, b, }
744-
}
745-
746-
#[no_mangle]
747-
pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
748-
#[repr(C)]
749714
pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
750715
pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
751716
pub err: *mut crate::ln::msgs::DecodeError,

0 commit comments

Comments
 (0)