-
Notifications
You must be signed in to change notification settings - Fork 902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitcoin backend generalization #3488
Bitcoin backend generalization #3488
Commits on Feb 11, 2020
-
Configuration menu - View commit details
-
Copy full SHA for fd6172a - Browse repository at this point
Copy the full SHA fd6172aView commit details -
libplugin: generalize the plugin_timer callback type
We don't take the callback result into account, so it can better be void. Having a general callback parameter is handy, because for bcli we want to pass it the struct bcli.
Configuration menu - View commit details
-
Copy full SHA for 22780f8 - Browse repository at this point
Copy the full SHA 22780f8View commit details -
plugins/bcli: a new plugin for gathering Bitcoin data
Most is taken from lightningd/bitcoind and adapted. This currently exposes 5 commands: - `getchaininfo`, currently called at startup to check the network and whether we are on IBD. - `getrawblockbyheight`, which basically does the `getblockhash` + `getblock` trick. - `getfeerate` - `sendrawtransaction` - `getutxout`, used to gather infos about an output and currently used by `getfilteredblock` in `lightningd/bitcoind`.
Configuration menu - View commit details
-
Copy full SHA for f5999fd - Browse repository at this point
Copy the full SHA f5999fdView commit details -
plugins/bcli: wait for bitcoind to be warmed up at init
This is also taken and adapted from lightningd/bitcoind. The call to 'getblockchaininfo' is replaced by 'echo' as we don't make use of the result and the former can sometimes be slow (e.g. on IBD).
Configuration menu - View commit details
-
Copy full SHA for 44d408c - Browse repository at this point
Copy the full SHA 44d408cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8261ff1 - Browse repository at this point
Copy the full SHA 8261ff1View commit details -
plugins/libplugin: don't crash if 'lightning-rpc' doesnt exist (yet)
We are going to initialize a plugin before its creation, so log as UNUSUAL instead. Also, `pay` and `fundchannel` inits are using rpc_delve(), so we need to io_new_conn() (which sets the socket as non blocking) after calling the plugin's init.
Configuration menu - View commit details
-
Copy full SHA for 983d2e3 - Browse repository at this point
Copy the full SHA 983d2e3View commit details -
chaintopology: check bitcoin plugin commands at startup
Exit early if we won't be able to fully communicate with our Bitcoin backend.
Configuration menu - View commit details
-
Copy full SHA for fbc92b0 - Browse repository at this point
Copy the full SHA fbc92b0View commit details -
bitcoind: allow commands to be registered by different plugins
An strmap is convenient to get a plugin given a method. Populate it while checking commands.
Configuration menu - View commit details
-
Copy full SHA for a3eb36b - Browse repository at this point
Copy the full SHA a3eb36bView commit details -
bitcoind: initialize Bitcoin-backend plugin early
We need our Bitcoin backend to be initialized, but the plugins have not yet been started at this point.
Configuration menu - View commit details
-
Copy full SHA for c21d902 - Browse repository at this point
Copy the full SHA c21d902View commit details -
chaintopology: dont check bitcoin-core version at startup
The Bitcoin backend is generalized through the Bitcoin plugin and this was specific to core.
Configuration menu - View commit details
-
Copy full SHA for ed2a714 - Browse repository at this point
Copy the full SHA ed2a714View commit details -
lightningd/chaintopology: use plugin backend to setup topology
This adds `getchaininfo` and `getrawblockbyheight` handling lightningd-side, and use them in setup_topology(). We then remove legacy bitcoind_getblockcount() (we already get the count in `getchaininfo`), bitcoind_getblockchaininfo() (it was only used in setup_topology()), and wait_for_bitcoind() (this was specific to bitcoin-core and we assume our Bitcoin backend to be functional if the plugin responds to `init`).
Configuration menu - View commit details
-
Copy full SHA for 3515cff - Browse repository at this point
Copy the full SHA 3515cffView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ff12ce - Browse repository at this point
Copy the full SHA 0ff12ceView commit details -
lightningd/bitcoind: use the Bitcoin plugin to send transactions
This restrains the informations we get about how the sending went to an errmsg as we cant rely on bitcoin-cli specific output nor its exit code.
Configuration menu - View commit details
-
Copy full SHA for 6aa9233 - Browse repository at this point
Copy the full SHA 6aa9233View commit details -
lightningd/bitcoind: use getrawblockatheight for getfilteredblock
This avoids the getblockhash+getblock, and more importantly that was the last functionality making use of bitcoind_getrawblock() and bitcoin_getblockhash(), so we can also get rid of them.
Configuration menu - View commit details
-
Copy full SHA for 900af43 - Browse repository at this point
Copy the full SHA 900af43View commit details -
Configuration menu - View commit details
-
Copy full SHA for fa7de2c - Browse repository at this point
Copy the full SHA fa7de2cView commit details -
lightningd/bitcoind: use the Bitcoin plugin for fee estimates
And remove bitcoin-cli interaction code, now unused.
Configuration menu - View commit details
-
Copy full SHA for a9239df - Browse repository at this point
Copy the full SHA a9239dfView commit details -
lightningd/bitcoind: remove all bitcoin-cli specific code
Changelog-Added: pluggable backends for Bitcoin data queries, default still bitcoind (using bitcoin-cli).
Configuration menu - View commit details
-
Copy full SHA for 6ee5fe4 - Browse repository at this point
Copy the full SHA 6ee5fe4View commit details -
lightningd: clean utxos after the topology is setup
We need our Bitcoin backend to be ready to get infos about some utxos
Configuration menu - View commit details
-
Copy full SHA for c3b175d - Browse repository at this point
Copy the full SHA c3b175dView commit details -
pytest: adjust mocks and logs for bitcoind
For bitcoind_fail_first: We only ever send `getblock` if we got a successful block hash from `getblockhash`, and if we can't get the block in that case it means our Bitcoin backend is faulty and we shouldnt continue. So, mock `getblockhash` instead, which is authorized to spuriously fail. For both bitcoind_fail_first and bitcoind_failure: Adapt the logs.
Configuration menu - View commit details
-
Copy full SHA for 08c0e08 - Browse repository at this point
Copy the full SHA 08c0e08View commit details -
Configuration menu - View commit details
-
Copy full SHA for 765033d - Browse repository at this point
Copy the full SHA 765033dView commit details -
Configuration menu - View commit details
-
Copy full SHA for f7b48ed - Browse repository at this point
Copy the full SHA f7b48edView commit details