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

Function list_rebalances

plugins/bkpr/recorder.c:1739–1768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1737}
1738
1739struct rebalance **list_rebalances(const tal_t *ctx, struct db *db)
1740{
1741 struct rebalance **result;
1742 struct db_stmt *stmt;
1743
1744 stmt = db_prepare_v2(db, SQL("SELECT "
1745 " in_e.id"
1746 ", out_e.id"
1747 ", in_acct.name"
1748 ", out_acct.name"
1749 ", in_e.credit"
1750 ", out_e.fees"
1751 " FROM channel_events in_e"
1752 " LEFT OUTER JOIN channel_events out_e"
1753 " ON in_e.rebalance_id = out_e.id"
1754 " LEFT OUTER JOIN accounts out_acct"
1755 " ON out_acct.id = out_e.account_id"
1756 " LEFT OUTER JOIN accounts in_acct"
1757 " ON in_acct.id = in_e.account_id"
1758 " WHERE in_e.rebalance_id IS NOT NULL"
1759 " AND in_e.credit > 0"));
1760 db_query_prepared(stmt);
1761 result = tal_arr(ctx, struct rebalance *, 0);
1762 while (db_step(stmt)) {
1763 struct rebalance *r = stmt2rebalance(result, stmt);
1764 tal_arr_expand(&result, r);
1765 }
1766 tal_free(stmt);
1767 return result;
1768}
1769
1770char *maybe_update_onchain_fees(const tal_t *ctx, struct db *db,
1771 struct bitcoin_txid *txid)

Callers 1

test_channel_rebalancesFunction · 0.85

Calls 4

db_query_preparedFunction · 0.85
db_stepFunction · 0.85
stmt2rebalanceFunction · 0.85
tal_freeFunction · 0.85

Tested by 1

test_channel_rebalancesFunction · 0.68