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

Function stmt2account

plugins/bkpr/recorder.c:1087–1123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1085}
1086
1087static struct account *stmt2account(const tal_t *ctx, struct db_stmt *stmt)
1088{
1089 struct account *a = tal(ctx, struct account);
1090
1091 a->db_id = db_col_u64(stmt, "id");
1092 a->name = db_col_strdup(a, stmt, "name");
1093
1094 if (!db_col_is_null(stmt, "peer_id")) {
1095 a->peer_id = tal(a, struct node_id);
1096 db_col_node_id(stmt, "peer_id", a->peer_id);
1097 } else
1098 a->peer_id = NULL;
1099 a->is_wallet = db_col_int(stmt, "is_wallet") != 0;
1100 a->we_opened = db_col_int(stmt, "we_opened") != 0;
1101 a->leased = db_col_int(stmt, "leased") != 0;
1102
1103 if (!db_col_is_null(stmt, "onchain_resolved_block")) {
1104 a->onchain_resolved_block = db_col_int(stmt, "onchain_resolved_block");
1105 } else
1106 a->onchain_resolved_block = 0;
1107
1108 if (!db_col_is_null(stmt, "opened_event_id")) {
1109 a->open_event_db_id = tal(a, u64);
1110 *a->open_event_db_id = db_col_u64(stmt, "opened_event_id");
1111 } else
1112 a->open_event_db_id = NULL;
1113
1114 if (!db_col_is_null(stmt, "closed_event_id")) {
1115 a->closed_event_db_id = tal(a, u64);
1116 *a->closed_event_db_id = db_col_u64(stmt, "closed_event_id");
1117 } else
1118 a->closed_event_db_id = NULL;
1119
1120 a->closed_count = db_col_int(stmt, "closed_count");
1121
1122 return a;
1123}
1124
1125struct account *find_account(const tal_t *ctx,
1126 struct db *db,

Callers 2

find_accountFunction · 0.85
list_accountsFunction · 0.85

Calls 5

db_col_u64Function · 0.85
db_col_strdupFunction · 0.85
db_col_is_nullFunction · 0.85
db_col_node_idFunction · 0.85
db_col_intFunction · 0.85

Tested by

no test coverage detected