From: Matt Corallo Date: Mon, 23 Nov 2020 16:11:55 +0000 (-0500) Subject: Update bindings demo for new ChannelMonitor-update API X-Git-Tag: v0.0.12~4^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=66f46d4ad3c53c315ced66865276765c2539804e;p=rust-lightning Update bindings demo for new ChannelMonitor-update API --- diff --git a/lightning-c-bindings/demo.cpp b/lightning-c-bindings/demo.cpp index 84d7904f8..531d7e679 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,