bitcoind: replace bitcoin-cli with a keep-alive JSON-RPC client - #248
erickcestari wants to merge 2 commits into
Conversation
|
Have you considered using the It does add a dependency, but it’s a small one. I think that's a good trade-off for the manual HTTP handling it removes. For reference, electrs uses the same setup: https://github.com/romanz/electrs/blob/d975dd03f2a410c4473116d5a2be950a205e0443/Cargo.toml#L31 |
8bc37f6 to
a898cf8
Compare
I think it's better to avoid adding a dependency for ~120 lines of code, and also keep control over the implementation. |
ekzyis
left a comment
There was a problem hiding this comment.
I think CLN requires bitcoin-cli here. lightningd fails to sync with a898cf8:
INFO [smite_scenarios::targets::bitcoind] Waiting for bitcoind to be ready...
INFO [smite_scenarios::targets::bitcoind] bitcoind is ready
INFO [smite_scenarios::targets::cln] Starting lightningd...
INFO [smite_scenarios::targets::cln] Waiting for lightningd to be ready and synced...
DEBUG [smite::process] bitcoind: dropping running process, attempting shutdown
DEBUG [smite::process] bitcoind: sending SIGTERM to process group 149
DEBUG [smite::process] bitcoind: exited with exit status: 0
ERROR [smite::scenarios] Failed to initialize scenario: target error: failed to start: lightningd failed to sync chain
[-] PROGRAM ABORT : Something went wrong ...
Location : afl_fsrv_start(), src/afl-forkserver.c:835
It works on 40e7f1f. Can you reproduce?
| /// - input variable refers to a void instruction | ||
| /// - input variable has the wrong type | ||
| /// - `MineBlocks(0)` (panics inside `BitcoinCli::mine_blocks`) | ||
| /// - `MineBlocks(0)` (panics inside `BitcoindClient::mine_blocks`) |
There was a problem hiding this comment.
nit: I think this was already wrong. I think mine_blocks doesn't panic anymore on 0 since a22c79b.
Every bitcoind call from the fuzz loop forked a
bitcoin-cliprocess inside the Nyx VM; a full funding flow spawned 12 of them. This replaces the transport with a small HTTP/1.1 client over oneTcpStreamto bitcoind's JSON-RPC port, then moves the startup calls onto it too sobitcoin-clidisappears from the images.Benchmark
input:
master:
This pr:
About 10% on this input. Inputs with fewer bitcoind calls gain proportionally less.