MCPcopy Create free account
hub / github.com/ElementsProject/lightning / find_watchscriptpubkey

Function find_watchscriptpubkey

lightningd/watch.c:348–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348static struct scriptpubkeywatch *find_watchscriptpubkey(const struct scriptpubkeywatch_hash *scriptpubkeywatches,
349 const u8 *scriptpubkey,
350 const struct bitcoin_outpoint *expected_outpoint,
351 struct amount_sat expected_amount,
352 void (*cb)(struct lightningd *ld,
353 const struct bitcoin_tx *tx,
354 u32 outnum,
355 const struct txlocator *loc,
356 void *),
357 void *arg)
358{
359 struct scriptpubkeywatch_hash_iter it;
360 const struct script_with_len swl = { scriptpubkey, tal_bytelen(scriptpubkey) };
361
362 for (struct scriptpubkeywatch *w = scriptpubkeywatch_hash_getfirst(scriptpubkeywatches, &swl, &it);
363 w;
364 w = scriptpubkeywatch_hash_getnext(scriptpubkeywatches, &swl, &it)) {
365 if (bitcoin_outpoint_eq(&w->expected_outpoint, expected_outpoint)
366 && amount_sat_eq(w->expected_amount, expected_amount)
367 && w->cb == cb
368 && w->arg == arg) {
369 return w;
370 }
371 }
372 return NULL;
373}
374
375bool watch_scriptpubkey_(const tal_t *ctx,
376 struct chain_topology *topo,

Callers 2

watch_scriptpubkey_Function · 0.85
unwatch_scriptpubkey_Function · 0.85

Calls 2

tal_bytelenFunction · 0.85
amount_sat_eqFunction · 0.50

Tested by

no test coverage detected