@@ -104,7 +104,7 @@ void print_log(const void *this_arg, const LDKRecord *record) {
104
104
}
105
105
106
106
uint32_t get_fee (const void *this_arg, LDKConfirmationTarget target) {
107
- if (target == LDKConfirmationTarget_Background ) {
107
+ if (target == LDKConfirmationTarget_AnchorChannelFee || target == LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee ) {
108
108
return 253 ;
109
109
} else {
110
110
return 507 ;
@@ -386,7 +386,7 @@ class PeersConnection {
386
386
387
387
struct CustomOnionMsgQueue {
388
388
std::mutex mtx;
389
- std::vector<LDK::CustomOnionMessageContents > msgs;
389
+ std::vector<LDK::OnionMessageContents > msgs;
390
390
};
391
391
392
392
uint64_t custom_onion_msg_type_id (const void *this_arg) {
@@ -400,31 +400,35 @@ LDKCVec_u8Z custom_onion_msg_bytes(const void *this_arg) {
400
400
};
401
401
}
402
402
403
- LDKCOption_CustomOnionMessageContentsZ handle_custom_onion_message (const void * this_arg, struct LDKCustomOnionMessageContents msg) {
403
+ LDKCOption_OnionMessageContentsZ handle_custom_onion_message (const void * this_arg, struct LDKOnionMessageContents msg) {
404
404
CustomOnionMsgQueue* arg = (CustomOnionMsgQueue*) this_arg;
405
405
std::unique_lock<std::mutex> lck (arg->mtx );
406
406
arg->msgs .push_back (std::move (msg));
407
- return COption_CustomOnionMessageContentsZ_none ();
407
+ return COption_OnionMessageContentsZ_none ();
408
408
}
409
409
410
- LDKCustomOnionMessageContents build_custom_onion_message () {
411
- return LDKCustomOnionMessageContents {
410
+ LDKOnionMessageContents build_custom_onion_message () {
411
+ return LDKOnionMessageContents {
412
412
.this_arg = NULL ,
413
413
.tlv_type = custom_onion_msg_type_id,
414
414
.write = custom_onion_msg_bytes,
415
415
.free = NULL ,
416
416
};
417
417
}
418
418
419
- LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_onion_message (const void * this_arg, uint64_t type, LDKu8slice buf) {
419
+ LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_onion_message (const void * this_arg, uint64_t type, LDKu8slice buf) {
420
420
assert (type == 8888 );
421
421
assert (buf.datalen == 1024 );
422
422
uint8_t cmp[1024 ];
423
423
memset (cmp, 43 , 1024 );
424
424
assert (!memcmp (cmp, buf.data , 1024 ));
425
- return CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok ( COption_CustomOnionMessageContentsZ_some (build_custom_onion_message ()));
425
+ return CResult_COption_OnionMessageContentsZDecodeErrorZ_ok ( COption_OnionMessageContentsZ_some (build_custom_onion_message ()));
426
426
}
427
427
428
+ LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_no_messages (const void * this_arg) {
429
+ return LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
430
+ .data = NULL , .datalen = 0 };
431
+ }
428
432
429
433
struct CustomMsgQueue {
430
434
std::vector<LDK::Type> msgs;
@@ -991,6 +995,7 @@ int main() {
991
995
.this_arg = NULL ,
992
996
.handle_custom_message = NULL , // We only create custom messages, not handle them
993
997
.read_custom_message = NULL , // We only create custom messages, not handle them
998
+ .release_pending_custom_messages = release_no_messages,
994
999
.free = NULL ,
995
1000
};
996
1001
LDK::DefaultMessageRouter mr1 = DefaultMessageRouter_new ();
@@ -1018,6 +1023,7 @@ int main() {
1018
1023
.this_arg = &peer_2_custom_onion_messages,
1019
1024
.handle_custom_message = handle_custom_onion_message,
1020
1025
.read_custom_message = read_custom_onion_message,
1026
+ .release_pending_custom_messages = release_no_messages,
1021
1027
.free = NULL ,
1022
1028
};
1023
1029
LDK::DefaultMessageRouter mr2 = DefaultMessageRouter_new ();
@@ -1178,10 +1184,8 @@ int main() {
1178
1184
LDKCVec_PublicKeyZ { .data = NULL , .datalen = 0 , },
1179
1185
Destination_node (ChannelManager_get_our_node_id (&cm2))
1180
1186
),
1181
- LDKOnionMessageContents {
1182
- .tag = LDKOnionMessageContents_Custom,
1183
- .custom = build_custom_onion_message ()
1184
- }, LDKBlindedPath { .inner = NULL , .is_owned = true })
1187
+ build_custom_onion_message (),
1188
+ LDKBlindedPath { .inner = NULL , .is_owned = true })
1185
1189
.result_ok );
1186
1190
PeerManager_process_events (&net1);
1187
1191
std::cout << __FILE__ << " :" << __LINE__ << " - " << " Awaiting onion message..." << std::endl;
0 commit comments