Skip to content

Commit 99cb6eb

Browse files
committed
bindings gen
1 parent 88cc043 commit 99cb6eb

File tree

8 files changed

+510
-497
lines changed

8 files changed

+510
-497
lines changed

lightning-c-bindings/include/lightning.h

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,27 @@ typedef enum LDKSecp256k1Error {
179179
LDKSecp256k1Error_Sentinel,
180180
} LDKSecp256k1Error;
181181

182+
/**
183+
* A serialized transaction, in (pointer, length) form.
184+
*
185+
* This type optionally owns its own memory, and thus the semantics around access change based on
186+
* the data_is_owned flag. If data_is_owned is set, you must call Transaction_free to free the
187+
* underlying buffer before the object goes out of scope. If data_is_owned is not set, any access
188+
* to the buffer after the scope in which the object was provided to you is invalid. eg, access
189+
* after you return from the call in which a !data_is_owned Transaction is provided to you would
190+
* be invalid.
191+
*
192+
* Note that, while it may change in the future, because transactions on the Rust side are stored
193+
* in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
194+
* set and all `Transaction`s you pass to Rust may have `data_is_owned` either set or unset at
195+
* your discretion.
196+
*/
197+
typedef struct LDKTransaction {
198+
uint8_t *data;
199+
uintptr_t datalen;
200+
bool data_is_owned;
201+
} LDKTransaction;
202+
182203
typedef struct LDKCVecTempl_u8 {
183204
uint8_t *data;
184205
uintptr_t datalen;
@@ -1409,16 +1430,6 @@ typedef struct LDKChainWatchInterface {
14091430
void (*free)(void *this_arg);
14101431
} LDKChainWatchInterface;
14111432

1412-
/**
1413-
* A reference to a serialized transaction, in (pointer, length) form.
1414-
* This type does *not* own its own memory, so access to it after, eg, the call in which it was
1415-
* provided to you are invalid.
1416-
*/
1417-
typedef struct LDKTransaction {
1418-
const uint8_t *data;
1419-
uintptr_t datalen;
1420-
} LDKTransaction;
1421-
14221433
/**
14231434
* An interface to send a transaction to the Bitcoin network.
14241435
*/
@@ -1431,12 +1442,12 @@ typedef struct LDKBroadcasterInterface {
14311442
void (*free)(void *this_arg);
14321443
} LDKBroadcasterInterface;
14331444

1434-
typedef struct LDKCVecTempl_CVec_u8Z {
1435-
LDKCVec_u8Z *data;
1445+
typedef struct LDKCVecTempl_Transaction {
1446+
LDKTransaction *data;
14361447
uintptr_t datalen;
1437-
} LDKCVecTempl_CVec_u8Z;
1448+
} LDKCVecTempl_Transaction;
14381449

1439-
typedef LDKCVecTempl_CVec_u8Z LDKCVec_TransactionZ;
1450+
typedef LDKCVecTempl_Transaction LDKCVec_TransactionZ;
14401451

14411452
typedef struct LDKusizeslice {
14421453
const uintptr_t *data;
@@ -3227,6 +3238,8 @@ extern const void (*CVec_usizeZ_free)(LDKCVec_usizeZ);
32273238

32283239
extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
32293240

3241+
void Transaction_free(LDKTransaction _res);
3242+
32303243
void TxOut_free(LDKTxOut _res);
32313244

32323245
LDKC2Tuple_Txidu32Z C2Tuple_Txidu32Z_new(LDKThirtyTwoBytes a, uint32_t b);
@@ -6467,19 +6480,19 @@ LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey cou
64676480
/**
64686481
* panics if htlc.transaction_output_index.is_none()!
64696482
*/
6470-
LDKCVec_u8Z build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey broadcaster_delayed_payment_key, LDKPublicKey revocation_key);
6483+
LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey broadcaster_delayed_payment_key, LDKPublicKey revocation_key);
64716484

64726485
void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr);
64736486

64746487
/**
64756488
* The commitment transaction itself, in unsigned form.
64766489
*/
6477-
LDKCVec_u8Z HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
6490+
LDKTransaction HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
64786491

64796492
/**
64806493
* The commitment transaction itself, in unsigned form.
64816494
*/
6482-
void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_u8Z val);
6495+
void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKTransaction val);
64836496

64846497
/**
64856498
* Our counterparty's signature for the transaction, above.
@@ -6522,7 +6535,7 @@ void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *th
65226535
* The unsigned transaction outputs must be consistent with htlc_data. This function
65236536
* only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
65246537
*/
6525-
MUST_USE_RES LDKHolderCommitmentTransaction HolderCommitmentTransaction_new_missing_holder_sig(LDKCVec_u8Z unsigned_tx, LDKSignature counterparty_sig, LDKPublicKey holder_funding_key, LDKPublicKey counterparty_funding_key, LDKTxCreationKeys keys, uint32_t feerate_per_kw, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data);
6538+
MUST_USE_RES LDKHolderCommitmentTransaction HolderCommitmentTransaction_new_missing_holder_sig(LDKTransaction unsigned_tx, LDKSignature counterparty_sig, LDKPublicKey holder_funding_key, LDKPublicKey counterparty_funding_key, LDKTxCreationKeys keys, uint32_t feerate_per_kw, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data);
65266539

65276540
/**
65286541
* The pre-calculated transaction creation public keys.

0 commit comments

Comments
 (0)