From 66f46d4ad3c53c315ced66865276765c2539804e Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 23 Nov 2020 11:11:55 -0500 Subject: [PATCH] Update bindings demo for new ChannelMonitor-update API --- lightning-c-bindings/demo.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lightning-c-bindings/demo.cpp b/lightning-c-bindings/demo.cpp index 84d7904f..531d7e67 100644 --- a/lightning-c-bindings/demo.cpp +++ b/lightning-c-bindings/demo.cpp @@ -110,6 +110,12 @@ uint32_t get_fee(const void *this_arg, LDKConfirmationTarget target) { } // Note that we don't call _free() on target, but that's OK, its unitary } +// We use the same fee estimator globally: +const LDKFeeEstimator fee_est { + .this_arg = NULL, + .get_est_sat_per_1000_weight = get_fee, + .free = NULL, +}; static int num_txs_broadcasted = 0; // Technically a race, but ints are atomic on x86 void broadcast_tx(const void *this_arg, LDKTransaction tx) { @@ -159,7 +165,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_monitor(const void *this_ LDKBroadcasterInterface broadcaster = { .broadcast_transaction = broadcast_tx, }; - LDK::CResult_NoneMonitorUpdateErrorZ res = ChannelMonitor_update_monitor(&mon.second, &update, &broadcaster, arg->logger); + LDK::CResult_NoneMonitorUpdateErrorZ res = ChannelMonitor_update_monitor(&mon.second, &update, &broadcaster, &fee_est, arg->logger); assert(res->result_ok); } } @@ -224,12 +230,6 @@ int main() { LDKNetwork network = LDKNetwork_Testnet; // Trait implementations: - LDKFeeEstimator fee_est { - .this_arg = NULL, - .get_est_sat_per_1000_weight = get_fee, - .free = NULL, - }; - LDKBroadcasterInterface broadcast { .this_arg = NULL, .broadcast_transaction = broadcast_tx, -- 2.30.2