Skip to content

Commit 66f46d4

Browse files
committed
Update bindings demo for new ChannelMonitor-update API
1 parent d169966 commit 66f46d4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lightning-c-bindings/demo.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ uint32_t get_fee(const void *this_arg, LDKConfirmationTarget target) {
110110
}
111111
// Note that we don't call _free() on target, but that's OK, its unitary
112112
}
113+
// We use the same fee estimator globally:
114+
const LDKFeeEstimator fee_est {
115+
.this_arg = NULL,
116+
.get_est_sat_per_1000_weight = get_fee,
117+
.free = NULL,
118+
};
113119

114120
static int num_txs_broadcasted = 0; // Technically a race, but ints are atomic on x86
115121
void broadcast_tx(const void *this_arg, LDKTransaction tx) {
@@ -159,7 +165,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_monitor(const void *this_
159165
LDKBroadcasterInterface broadcaster = {
160166
.broadcast_transaction = broadcast_tx,
161167
};
162-
LDK::CResult_NoneMonitorUpdateErrorZ res = ChannelMonitor_update_monitor(&mon.second, &update, &broadcaster, arg->logger);
168+
LDK::CResult_NoneMonitorUpdateErrorZ res = ChannelMonitor_update_monitor(&mon.second, &update, &broadcaster, &fee_est, arg->logger);
163169
assert(res->result_ok);
164170
}
165171
}
@@ -224,12 +230,6 @@ int main() {
224230
LDKNetwork network = LDKNetwork_Testnet;
225231

226232
// Trait implementations:
227-
LDKFeeEstimator fee_est {
228-
.this_arg = NULL,
229-
.get_est_sat_per_1000_weight = get_fee,
230-
.free = NULL,
231-
};
232-
233233
LDKBroadcasterInterface broadcast {
234234
.this_arg = NULL,
235235
.broadcast_transaction = broadcast_tx,

0 commit comments

Comments
 (0)