| 1911 | } |
| 1912 | |
| 1913 | static 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 | |
| 1950 | static void load_currencyrates(struct command *cmd, |
| 1951 | struct bkpr *bkpr) |
nothing calls this directly
no test coverage detected