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

Function wait_done

plugins/sql.c:1281–1319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1279 u64 next_index);
1280
1281static struct command_result *wait_done(struct command *auxcmd,
1282 const char *method,
1283 const char *buf,
1284 const jsmntok_t *result,
1285 struct table_desc *td)
1286{
1287 const jsmntok_t *valtok;
1288 const char *indexname;
1289 u64 val;
1290
1291 if ((valtok = json_get_member(buf, result, "created")) != NULL) {
1292 indexname = "created";
1293 td->refresh_needs |= REFRESH_CREATED;
1294 } else if ((valtok = json_get_member(buf, result, "updated")) != NULL) {
1295 indexname = "updated";
1296 td->refresh_needs |= REFRESH_UPDATED;
1297 } else if ((valtok = json_get_member(buf, result, "deleted")) != NULL) {
1298 indexname = "deleted";
1299 td->refresh_needs |= REFRESH_DELETED;
1300 } else {
1301 plugin_err(auxcmd->plugin,
1302 "Invalid wait_done for %s: '%.*s'",
1303 td->name,
1304 json_tok_full_len(result),
1305 json_tok_full(buf, result));
1306 }
1307
1308 if (!json_to_u64(buf, valtok, &val)) {
1309 plugin_err(auxcmd->plugin,
1310 "Invalid wait_done index for %s: '%.*s'",
1311 td->name,
1312 json_tok_full_len(result),
1313 json_tok_full(buf, result));
1314 }
1315
1316 /* Keep watching for next one */
1317 watch_for(sql_of(auxcmd->plugin), td, indexname, val + 1);
1318 return command_still_pending(auxcmd);
1319}
1320
1321static void watch_for(struct sql *sql,
1322 struct table_desc *td,

Callers

nothing calls this directly

Calls 8

json_get_memberFunction · 0.85
watch_forFunction · 0.85
sql_ofFunction · 0.85
plugin_errFunction · 0.70
command_still_pendingFunction · 0.70
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
json_to_u64Function · 0.50

Tested by

no test coverage detected