feat: add multi-network support (testnet/signet/regtest)#14
feat: add multi-network support (testnet/signet/regtest)#14b-l-u-e wants to merge 7 commits into2140-dev:masterfrom
Conversation
|
Thanks for the PR! Could you rebase this onto the latest master there have been some recent fixes that need to be incorporated. Also, to make the review easier, it would be great if you could split this into atomic commits, with each commit relating to a single, isolated change |
Thank you for the feedback I will adjust the changes |
ff94a34 to
25c0867
Compare
ismaelsadeeq
left a comment
There was a problem hiding this comment.
I did a first pass at this.
The organization of the commits seems somewhat arbitrary and does not flow.
You are testing something before it is introduced.
Did you test this locally? I have a branch already with some data, and running this branch seems to cause a recurrent crash in the backend process.
logs
objc[61969]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,161 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,161 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61970]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61970]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,216 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,216 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61971]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61971]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,265 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,265 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61972]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61972]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,353 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,353 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61973]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61973]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,433 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,433 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61974]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61974]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,456 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,457 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61975]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61975]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,521 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,521 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61976]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61976]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,585 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,586 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61977]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61977]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,599 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,599 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61978]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61978]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,655 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,656 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61979]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61979]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
2026-03-12 14:24:40,726 - services.database_service - INFO - Database initialised at /Users/abubakarismail/Desktop/Work/bitcoin-dev/bitcoin-core-fees/backend/src/services/fee_analysis.db
2026-03-12 14:24:40,726 - collector - INFO - Starting high-resolution fee estimate collector (7s interval)...
objc[61980]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[61980]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
yeah it was working on my end... i ran the command again to see if will face the same issue and still running show logs2026-03-13 09:44:54,655 - collector - INFO - [Collector] SAVED: target=7 height=295362 rate=1.00 sat/vB |
There was a problem hiding this comment.
yeah it was working on my end... i ran the command again to see if will face the same issue and still running
I debugged this today, and it seems this is not an issue introduced in this PR.
The fork safety crash is a known macOS issue unrelated to these changes export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES suppresses it locally, and I can confirm the branch behaves as expected on my end.
I'd suggest one change in approach — rather than a single fee_analysis.db with a network column, separate the databases by directory to match Bitcoin Core's style data dir convention:
fee_analysis.db # mainnet — unchanged, no migration
testnet3/fee_analysis.db
signet/fee_analysis.db
regtest/fee_analysis.db
e.t.c
- The current
OR network IS NULLfallback inget_estimates_in_rangeis fragile and can be prone to bugs. WHERE network = ?can be dropped from every DB call since isolation is handled at the file level and we just append the test directory, it is easy to reason about.- Existing mainnet data is untouched no migration needed, the root
fee_analysis.dbpath stays the same - With this, it is easy to wipe a network
rm -rf testnet3/without touching another network data
|
A nice extension to this would be to serve estimates for other networks as well, all from the same frontend u.i. For example, the page could be reloaded to show available networks without needing to restart. The node’s configuration file (rpc_config.ini) could include an added option for the mainnet configuration, and all testnet configurations, excluding regtest. Then, the UI could display the available networks. I think this aligns well with #14 (review)
|
|
the dropdown-style im wandering which option will be better a single active chain per process with one collector targeting the selected RPC or parallel RPC connections with collectors per configured chain with the UI only selecting which chain’s data to fetch. |
This is more ideal |
GET /networks returns the list of connected chains. Every existing route (/fees, /blockcount, /mempool-diagram, /performance-data, /fees-sum) now accepts ?chain= to target a specific node. Unknown chain values return 400. DB init runs for every configured chain at startup.
25c0867 to
2ee6eb2
Compare
|
i faced an issue with lint formatting |

This PR adds multi-network support: the app detects the connected chain via
getblockchaininfoRPC and stores fee estimates per network so mainnet and testnet data are not mixed.getblockchaininfoon startup and when serving fee/blockcount;chainandchain_displayare returned to the frontend.fee_estimatestable has anetworkcolumn with a migration for existing DBs; collector and read paths filter by current network.NetworkBadgeshows the detected network (MAINNET / TESTNET / SIGNET / REGTEST) on the dashboard, Stats, and Mempool pages.rpc_config.ini.exampledocuments port mapping; README updated with multi-network behaviour.Dependency
i believe this branch depends on #13
Closes #7