@@ -179,6 +179,27 @@ typedef enum LDKSecp256k1Error {
179
179
LDKSecp256k1Error_Sentinel ,
180
180
} LDKSecp256k1Error ;
181
181
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
+
182
203
typedef struct LDKCVecTempl_u8 {
183
204
uint8_t * data ;
184
205
uintptr_t datalen ;
@@ -1409,16 +1430,6 @@ typedef struct LDKChainWatchInterface {
1409
1430
void (* free )(void * this_arg );
1410
1431
} LDKChainWatchInterface ;
1411
1432
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
-
1422
1433
/**
1423
1434
* An interface to send a transaction to the Bitcoin network.
1424
1435
*/
@@ -1431,12 +1442,12 @@ typedef struct LDKBroadcasterInterface {
1431
1442
void (* free )(void * this_arg );
1432
1443
} LDKBroadcasterInterface ;
1433
1444
1434
- typedef struct LDKCVecTempl_CVec_u8Z {
1435
- LDKCVec_u8Z * data ;
1445
+ typedef struct LDKCVecTempl_Transaction {
1446
+ LDKTransaction * data ;
1436
1447
uintptr_t datalen ;
1437
- } LDKCVecTempl_CVec_u8Z ;
1448
+ } LDKCVecTempl_Transaction ;
1438
1449
1439
- typedef LDKCVecTempl_CVec_u8Z LDKCVec_TransactionZ ;
1450
+ typedef LDKCVecTempl_Transaction LDKCVec_TransactionZ ;
1440
1451
1441
1452
typedef struct LDKusizeslice {
1442
1453
const uintptr_t * data ;
@@ -3227,6 +3238,8 @@ extern const void (*CVec_usizeZ_free)(LDKCVec_usizeZ);
3227
3238
3228
3239
extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT ;
3229
3240
3241
+ void Transaction_free (LDKTransaction _res );
3242
+
3230
3243
void TxOut_free (LDKTxOut _res );
3231
3244
3232
3245
LDKC2Tuple_Txidu32Z C2Tuple_Txidu32Z_new (LDKThirtyTwoBytes a , uint32_t b );
@@ -6467,19 +6480,19 @@ LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey cou
6467
6480
/**
6468
6481
* panics if htlc.transaction_output_index.is_none()!
6469
6482
*/
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 );
6471
6484
6472
6485
void HolderCommitmentTransaction_free (LDKHolderCommitmentTransaction this_ptr );
6473
6486
6474
6487
/**
6475
6488
* The commitment transaction itself, in unsigned form.
6476
6489
*/
6477
- LDKCVec_u8Z HolderCommitmentTransaction_get_unsigned_tx (const LDKHolderCommitmentTransaction * this_ptr );
6490
+ LDKTransaction HolderCommitmentTransaction_get_unsigned_tx (const LDKHolderCommitmentTransaction * this_ptr );
6478
6491
6479
6492
/**
6480
6493
* The commitment transaction itself, in unsigned form.
6481
6494
*/
6482
- void HolderCommitmentTransaction_set_unsigned_tx (LDKHolderCommitmentTransaction * this_ptr , LDKCVec_u8Z val );
6495
+ void HolderCommitmentTransaction_set_unsigned_tx (LDKHolderCommitmentTransaction * this_ptr , LDKTransaction val );
6483
6496
6484
6497
/**
6485
6498
* Our counterparty's signature for the transaction, above.
@@ -6522,7 +6535,7 @@ void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *th
6522
6535
* The unsigned transaction outputs must be consistent with htlc_data. This function
6523
6536
* only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
6524
6537
*/
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 );
6526
6539
6527
6540
/**
6528
6541
* The pre-calculated transaction creation public keys.
0 commit comments