db: Consolidate access to the changes in a db

We were passing them in separately, while we could just retrieve them from the
db instance instead.
This commit is contained in:
Christian Decker
2019-12-18 11:06:09 +01:00
committed by neil saitug
parent 5baf39e7dc
commit 6020a0d587
6 changed files with 17 additions and 9 deletions

View File

@@ -156,13 +156,14 @@ static void db_hook_response(const char *buffer, const jsmntok_t *toks,
io_break(ph_req);
}
void plugin_hook_db_sync(struct db *db, const char **changes, const char *final)
void plugin_hook_db_sync(struct db *db)
{
const struct plugin_hook *hook = &db_write_hook;
struct jsonrpc_request *req;
struct plugin_hook_request *ph_req;
void *ret;
const char **changes = db_changes(db);
if (!hook->plugin)
return;
@@ -177,8 +178,6 @@ void plugin_hook_db_sync(struct db *db, const char **changes, const char *final)
json_array_start(req->stream, "writes");
for (size_t i = 0; i < tal_count(changes); i++)
json_add_string(req->stream, NULL, changes[i]);
if (final)
json_add_string(req->stream, NULL, final);
json_array_end(req->stream);
jsonrpc_request_end(req);