Skip to content

Commit a08e282

Browse files
committed
Update C/C++ demo apps for new upstream API
1 parent f88af9a commit a08e282

File tree

2 files changed

+81
-55
lines changed

2 files changed

+81
-55
lines changed

lightning-c-bindings/demo.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ uint32_t get_fee(const void *this_arg, LDKConfirmationTarget target) {
2020
}
2121
}
2222

23-
void broadcast_tx(const void *this_arg, LDKTransaction tx) {
23+
void broadcast_txn(const void *this_arg, LDKCVec_TransactionZ txn) {
2424
//TODO
25-
Transaction_free(tx);
25+
CVec_TransactionZ_free(txn);
2626
}
2727

2828
LDKChannelMonitorUpdateStatus add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
@@ -44,12 +44,12 @@ void never_handle_event(const void *this_arg, const struct LDKEvent event) {
4444
assert(false);
4545
}
4646

47-
LDKCResult_RouteLightningErrorZ do_find_route(const void *this_arg, LDKPublicKey payer, const LDKRouteParameters *route_params, LDKCVec_ChannelDetailsZ *first_hops, const LDKInFlightHtlcs *inflight_htlcs) {
47+
LDKCResult_RouteLightningErrorZ do_find_route(const void *this_arg, LDKPublicKey payer, const LDKRouteParameters *route_params, LDKCVec_ChannelDetailsZ *first_hops, const LDKInFlightHtlcs inflight_htlcs) {
4848
LDKStr reason = { .chars = (const unsigned char*)"", .len = 0, .chars_is_owned = false };
4949
return CResult_RouteLightningErrorZ_err(LightningError_new(reason, ErrorAction_ignore_error()));
5050
}
5151

52-
LDKCResult_RouteLightningErrorZ do_find_route_with_id(const void *this_arg, LDKPublicKey payer, const LDKRouteParameters *route_params, LDKCVec_ChannelDetailsZ *first_hops, const LDKInFlightHtlcs *inflight_htlcs, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_id) {
52+
LDKCResult_RouteLightningErrorZ do_find_route_with_id(const void *this_arg, LDKPublicKey payer, const LDKRouteParameters *route_params, LDKCVec_ChannelDetailsZ *first_hops, const LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_id) {
5353
LDKStr reason = { .chars = (const unsigned char*)"", .len = 0, .chars_is_owned = false };
5454
return CResult_RouteLightningErrorZ_err(LightningError_new(reason, ErrorAction_ignore_error()));
5555
}
@@ -82,7 +82,7 @@ int main() {
8282

8383
LDKBroadcasterInterface broadcast = {
8484
.this_arg = NULL,
85-
.broadcast_transaction = broadcast_tx,
85+
.broadcast_transactions = broadcast_txn,
8686
.free = NULL,
8787
};
8888

@@ -102,7 +102,7 @@ int main() {
102102
LDKThirtyTwoBytes chain_tip;
103103
memset(&chain_tip, 0, 32);
104104
LDKChainParameters chain = ChainParameters_new(net, BestBlock_new(chain_tip, 0));
105-
LDKChannelManager cm = ChannelManager_new(fee_est, mon, broadcast, router, logger, entropy_source, node_signer, signer_provider, config, chain);
105+
LDKChannelManager cm = ChannelManager_new(fee_est, mon, broadcast, router, logger, entropy_source, node_signer, signer_provider, config, chain, 42);
106106

107107
LDKCVec_ChannelDetailsZ channels = ChannelManager_list_channels(&cm);
108108
assert((unsigned long)channels.data < 4096); // There's an offset, but it should still be an offset against null in the 0 page

0 commit comments

Comments
 (0)