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

Function db_col_datastore_key

wallet/wallet.c:5140–5163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5138}
5139
5140static const char **db_col_datastore_key(const tal_t *ctx,
5141 struct db_stmt *stmt,
5142 const char *colname)
5143{
5144 char **key;
5145 const u8 *joined = db_col_blob(stmt, colname);
5146 size_t len = db_col_bytes(stmt, colname);
5147
5148 key = tal_arr(ctx, char *, 0);
5149 do {
5150 size_t partlen;
5151 for (partlen = 0; partlen < len; partlen++) {
5152 if (joined[partlen] == '\0') {
5153 partlen++;
5154 break;
5155 }
5156 }
5157 tal_arr_expand(&key, tal_strndup(key, (char *)joined, partlen));
5158 len -= partlen;
5159 joined += partlen;
5160 } while (len != 0);
5161
5162 return cast_const2(const char **, key);
5163}
5164
5165void wallet_datastore_update(struct wallet *w, const char **key, const u8 *data)
5166{

Callers 1

wallet_datastore_nextFunction · 0.85

Calls 2

db_col_blobFunction · 0.85
db_col_bytesFunction · 0.85

Tested by

no test coverage detected