neutrino
neutrino copied to clipboard
Add Browser Support
This PR adds support for the browser using indexeddb as a storage backend for headerfs
instead of the file system.
Why IndexedDB?
I'd initially chosen to go with localStorage for simplicity but due to recent rate limiting changes it made syncing past a couple 100 blocks freeze, indexddb does not have share these limitations. I'd also looked into emulating the file system but it turned out to add a lot of complexity with a performance loss over just using indexeddb directly.
Browser Testing.
Since Go only provides an executor for your native platform testing needs to be done via a custom executor targeting the browser. I've written my own called wasmexec
which also provides file system access for ease of testing, you can run tests via the following:
# install wasmexec from the add-file-system branch while #1 is in progress.
go install github.com/linden/wasmexec@add-file-system
# target javascript/wasm and execute via wasmexec.
GOOS=js GOARCH=wasm go test -exec wasmexec ./...
I'm planning on provider this as part of a Github Action in the future.
btcd
Changes.
Running this in the browser without wasmexec
's file system access requires a couple of changes to btcd
's addrmgr
& btcutil
as they require a file system. Changes made in https://github.com/btcsuite/btcd/pull/2124.
@linden, remember to re-request review from reviewers when ready
Closing due to inactivity
Closing due to inactivity
Closing due to inactivity
Closing due to inactivity
Closing due to inactivity
Closing due to inactivity
Closing due to inactivity
Closing due to inactivity
Closing due to inactivity
Closing due to inactivity
!lightninglabs-deploy mute