Page MenuHomePhabricator

[Cashtab] Switch chronik backends on server error
AbandonedPublic

Authored by bytesofman on Dec 6 2022, 12:50.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

T2735

Cashtab was designed to switch to a new bch-api server when one went down. This has not yet been implemented for chronik.

This diff implements it for chronik.

Test Plan

npm start
wait for chronik to throw an error. It will, because the first two URLs are intentionally set incorrectly.
Watch dev log to see tryNextChronikUrl iterating until it gets to a good server
UI is restored, app works
Note that websocket reconnect attempts for the invalid chronik instance also stop

Diff Detail

Repository
rABC Bitcoin ABC
Branch
backup-chronik
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 21409
Build 42468: Build Diffcashtab-tests
Build 42467: arc lint + arc unit

Event Timeline

  1. Need a better way of handling websocket reconnects. We don't want to disable autoreconnect, we want to close out websocket connections if they came from a chronik instance that errored out.

Currently, if we don't use autoReconnect: true, the app will keep trying to reconnect to down websockets, even after it has connected to the good ones.

  1. Need to have BCH out of parseChronikTx so you can fully remove it from useWallet.js

Getting this to work as a proof of concept

bytesofman edited the test plan for this revision. (Show Details)

This is now a working proof of concept for the approach we need to take to implement redundant chronik instances for Cashtab.

However,

  1. The approach is somewhat complex
  2. The BCH parameter should be removed before this is implemented

So, will wait on the last T2730 diffs to land. Then I will put this up as a stacked diff.