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

Function init

plugins/bkpr/bookkeeper.c:1913–1948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1911}
1912
1913static const char *init(struct command *init_cmd, const char *b, const jsmntok_t *t)
1914{
1915 struct plugin *p = init_cmd->plugin;
1916 struct bkpr *bkpr = bkpr_of(p);
1917 be64 index;
1918
1919 bkpr->accounts = init_accounts(bkpr, init_cmd);
1920 bkpr->onchain_fees = init_onchain_fees(bkpr, init_cmd);
1921 bkpr->descriptions = init_descriptions(bkpr, init_cmd);
1922 bkpr->rebalances = init_rebalances(bkpr, init_cmd);
1923 bkpr->blockheights = init_blockheights(bkpr, init_cmd);
1924 bkpr->rinfo = NULL;
1925
1926 /* Callers always expect the wallet account to exist. */
1927 find_or_create_account(init_cmd, bkpr, ACCOUNT_NAME_WALLET);
1928
1929 /* Not existing is OK! */
1930 if (rpc_scan_datastore_hex(tmpctx, init_cmd,
1931 mkdatastorekey(tmpctx, "bookkeeper", "channelmoves_index"),
1932 JSON_SCAN(json_hex_to_be64, &index)) == NULL) {
1933 bkpr->channelmoves_index = be64_to_cpu(index);
1934 } else
1935 bkpr->channelmoves_index = 0;
1936 if (rpc_scan_datastore_hex(tmpctx, init_cmd,
1937 mkdatastorekey(tmpctx, "bookkeeper", "chainmoves_index"),
1938 JSON_SCAN(json_hex_to_be64, &index)) == NULL) {
1939 bkpr->chainmoves_index = be64_to_cpu(index);
1940 } else
1941 bkpr->chainmoves_index = 0;
1942
1943 /* If we're supposed to do currency conversions, start refresh now. */
1944 if (bkpr->currency)
1945 start_waiting_for_currency(bkpr, init_cmd);
1946
1947 return NULL;
1948}
1949
1950static void load_currencyrates(struct command *cmd,
1951 struct bkpr *bkpr)

Callers

nothing calls this directly

Calls 10

be64_to_cpuFunction · 0.85
bkpr_ofFunction · 0.70
init_accountsFunction · 0.70
init_onchain_feesFunction · 0.70
init_descriptionsFunction · 0.70
init_rebalancesFunction · 0.70
init_blockheightsFunction · 0.70
find_or_create_accountFunction · 0.70
rpc_scan_datastore_hexFunction · 0.50

Tested by

no test coverage detected