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

Function account_add

plugins/bkpr/recorder.c:1222–1249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1220}
1221
1222void account_add(struct db *db, struct account *acct)
1223{
1224 struct db_stmt *stmt;
1225
1226 stmt = db_prepare_v2(db, SQL("INSERT INTO accounts"
1227 " ("
1228 " name"
1229 ", peer_id"
1230 ", is_wallet"
1231 ", we_opened"
1232 ", leased"
1233 ")"
1234 " VALUES"
1235 " (?, ?, ?, ?, ?);"));
1236
1237 db_bind_text(stmt, 0, acct->name);
1238 if (acct->peer_id)
1239 db_bind_node_id(stmt, 1, acct->peer_id);
1240 else
1241 db_bind_null(stmt, 1);
1242 db_bind_int(stmt, 2, acct->is_wallet ? 1 : 0);
1243 db_bind_int(stmt, 3, acct->we_opened ? 1 : 0);
1244 db_bind_int(stmt, 4, acct->leased ? 1 : 0);
1245
1246 db_exec_prepared_v2(stmt);
1247 acct->db_id = db_last_insert_id_v2(stmt);
1248 tal_free(stmt);
1249}
1250
1251void maybe_update_account(struct db *db,
1252 struct account *acct,

Callers 10

json_balance_snapshotFunction · 0.85
parse_and_log_chain_moveFunction · 0.85
test_channel_rebalancesFunction · 0.85
test_channel_event_crudFunction · 0.85
test_chain_event_crudFunction · 0.85
test_account_balancesFunction · 0.85
test_account_crudFunction · 0.85

Calls 7

db_bind_textFunction · 0.85
db_bind_node_idFunction · 0.85
db_bind_nullFunction · 0.85
db_bind_intFunction · 0.85
db_exec_prepared_v2Function · 0.85
db_last_insert_id_v2Function · 0.85
tal_freeFunction · 0.85

Tested by 8

test_channel_rebalancesFunction · 0.68
test_channel_event_crudFunction · 0.68
test_chain_event_crudFunction · 0.68
test_account_balancesFunction · 0.68
test_account_crudFunction · 0.68