janoside / btc-rpc-explorer

Database-free, self-hosted Bitcoin explorer, via RPC to Bitcoin Core.
https://bitcoinexplorer.org
MIT License
1.52k stars 1.13k forks source link

txindex status not updated after bitcoind restart #357

Open Kixunil opened 3 years ago

Kixunil commented 3 years ago

Describe the bug

If btc-rpc-explorer starts without txindex being available and bitcoind is reconfigured to use txindex, btc-rpc-explorer requires restart to notice that.

Note this was tested with older version but reading changelog I don't think it was fixed. I will make sure retest with newer version this later. I just can't right now.

Environment (please complete the following information):

Configuration file content

bitcoin.conf

regtest=1
[regtest]

bind=0.0.0.0:18444

datadir=/var/lib/bitcoin-regtest

dbcache=1024

fallbackfee=0.00001

rpccookiefile=/var/run/bitcoin-regtest/cookie

rpcport=18442

startupnotify=systemd-notify --ready; echo Notified systemd >&2; /usr/share/bitcoind/notify_startup.sh regtest

prune=0

txindex=1

explorer env

BTCEXP_ADDRESS_API=

BTCEXP_BITCOIND_HOST=127.0.0.1

BTCEXP_BITCOIND_PASS=public

BTCEXP_BITCOIND_PORT=18443

BTCEXP_BITCOIND_USER=public

BTCEXP_PORT=5002

BTCEXP_PRIVACY_MODE=true

BTCEXP_SSO_TOKEN_FILE=/var/run/btc-rpc-explorer-regtest/sso/cookie

BTCEXP_BASEURL=/btc-explorer-rt

To Reproduce

Steps to reproduce the behavior:

  1. Insall bitcoind without txindex and btc-rpc-explorer
  2. Open btc-rpc-explorer, log in (SSO in my case), and check node details page
  3. Modify the config of bitcoind to set txindex=1
  4. Restart bitcoind
  5. Refresh node details page
  6. See txindex still not being set
  7. Restart btc-rpc-explorer
  8. Reopen btc-rpc-explorer and log in (login is invalidated due to restart)
  9. See that node details now indicates txindex being enabled

Screenshots or Log Output After start of btc-rpc-explorer, these lines are in the log exactly once:

Aug 12 13:03:03 disp9280 btc-rpc-explorer[10370]: 2021-08-12T11:03:03.354Z btcexp:app txindex check: trying getindexinfo
Aug 12 13:03:03 disp9280 btc-rpc-explorer[10370]: 2021-08-12T11:03:03.370Z btcexp:app txindex check: getindexinfo={}
Aug 12 13:03:03 disp9280 btc-rpc-explorer[10370]: 2021-08-12T11:03:03.371Z btcexp:app txindex check: unavailable

So I assume btc-rpc-explorer doesn't notice the connection dropped and doesn't refresh txindex.

Additional context

btc-rpc-proxy might have something to do with it too, I can retest without it later if you want.

pointbiz commented 1 year ago

I believe a restart of Electrumx is also not detected and requires the explorer to be restarted.