X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fdemo.cpp;h=ac82b739811ed9af4618e69140b5c274c5c5ff83;hb=6becb3248617a383229c4d310d68308411fa6ede;hp=5b9b7137cb4ef7e32999837e055bbb5528afbd63;hpb=1cb8b673bc75b90df10704fd28947b4fd79c97ab;p=ldk-c-bindings diff --git a/lightning-c-bindings/demo.cpp b/lightning-c-bindings/demo.cpp index 5b9b713..ac82b73 100644 --- a/lightning-c-bindings/demo.cpp +++ b/lightning-c-bindings/demo.cpp @@ -167,7 +167,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_monitor(const void *this_ LDKBroadcasterInterface broadcaster = { .broadcast_transaction = broadcast_tx, }; - LDK::CResult_NoneNoneZ res = ChannelMonitor_update_monitor(&mon.second, &update, &broadcaster, &fee_est, arg->logger); + LDK::CResult_NoneNoneZ res = ChannelMonitor_update_monitor(&mon.second, &update, &broadcaster, fee_est, arg->logger); assert(res->result_ok); } } @@ -176,12 +176,12 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_monitor(const void *this_ mons_updated += 1; return CResult_NoneChannelMonitorUpdateErrZ_ok(); } -LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ monitors_pending_monitor_events(const void *this_arg) { +LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ monitors_pending_monitor_events(const void *this_arg) { NodeMonitors* arg = (NodeMonitors*) this_arg; std::unique_lock l(arg->mut); if (arg->mons.size() == 0) { - return LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ { + return LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ { .data = NULL, .datalen = 0, }; @@ -192,12 +192,13 @@ LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ monitors_pending_monitor_events(con LDK::CVec_MonitorEventZ events = ChannelMonitor_get_and_clear_pending_monitor_events(&arg->mons[0].second); LDK::C2Tuple_OutPointScriptZ funding_info = ChannelMonitor_get_funding_txo(&arg->mons[0].second); LDK::OutPoint outpoint = std::move(funding_info->a); - LDK::C2Tuple_OutPointCVec_MonitorEventZZ pair = C2Tuple_OutPointCVec_MonitorEventZZ_new(std::move(outpoint), std::move(events)); - auto vec = LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ { - .data = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)malloc(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ)), + LDKPublicKey counterparty_node_id = ChannelMonitor_get_counterparty_node_id(&arg->mons[0].second); + LDK::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ tuple = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(std::move(outpoint), std::move(events), std::move(counterparty_node_id)); + auto vec = LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ { + .data = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)malloc(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)), .datalen = 1, }; - vec.data[0] = std::move(pair); + vec.data[0] = std::move(tuple); return vec; } } @@ -555,7 +556,7 @@ int main() { LDK::ChannelHandshakeConfig handshake_config2 = ChannelHandshakeConfig_default(); ChannelHandshakeConfig_set_minimum_depth(&handshake_config2, 2); LDK::UserConfig config2 = UserConfig_default(); - UserConfig_set_own_channel_config(&config2, std::move(handshake_config2)); + UserConfig_set_channel_handshake_config(&config2, std::move(handshake_config2)); LDK::ChannelManager cm2 = ChannelManager_new(fee_est, mon2, broadcast, logger2, KeysManager_as_KeysInterface(&keys2), std::move(config2), ChainParameters_new(network, BestBlock_new(chain_tip, 0))); @@ -711,7 +712,8 @@ int main() { LDK::RouteParameters route_params = RouteParameters_new(PaymentParameters_new( ChannelManager_get_our_node_id(&cm2), LDKInvoiceFeatures { .inner = NULL, .is_owned = false - }, Invoice_route_hints(invoice->contents.result), COption_u64Z_none(), 0xffffffff), + }, Invoice_route_hints(invoice->contents.result), COption_u64Z_none(), 0xffffffff, + 1, 2, LDKCVec_u64Z { .data = NULL, .datalen = 0 }), 5000, Invoice_min_final_cltv_expiry(invoice->contents.result)); random_bytes = keys_source1->get_secure_random_bytes(keys_source1->this_arg);