| 346 | } |
| 347 | |
| 348 | static 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 | |
| 375 | bool watch_scriptpubkey_(const tal_t *ctx, |
| 376 | struct chain_topology *topo, |
no test coverage detected