projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d169966
)
Update bindings demo for new ChannelMonitor-update API
author
Matt Corallo
<git@bluematt.me>
Mon, 23 Nov 2020 16:11:55 +0000
(11:11 -0500)
committer
Matt Corallo
<git@bluematt.me>
Mon, 23 Nov 2020 16:12:37 +0000
(11:12 -0500)
lightning-c-bindings/demo.cpp
patch
|
blob
|
history
diff --git
a/lightning-c-bindings/demo.cpp
b/lightning-c-bindings/demo.cpp
index 84d7904f8e62e59e7e0ee156d326ec078a62f083..531d7e679e522c38b59cb3285742765b40432bbb 100644
(file)
--- 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
}
}
// 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) {
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,
};
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);
}
}
assert(res->result_ok);
}
}
@@
-224,12
+230,6
@@
int main() {
LDKNetwork network = LDKNetwork_Testnet;
// Trait implementations:
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,
LDKBroadcasterInterface broadcast {
.this_arg = NULL,
.broadcast_transaction = broadcast_tx,