X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fdemo.cpp;h=531d7e679e522c38b59cb3285742765b40432bbb;hb=66f46d4ad3c53c315ced66865276765c2539804e;hp=84d7904f8e62e59e7e0ee156d326ec078a62f083;hpb=d169966f76c739d184a294fe08446b3b787fff8f;p=rust-lightning 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,