Skip to content

Commit

Permalink
Merge #1222: Add Electrum backend
Browse files Browse the repository at this point in the history
341f940 func test: prevent disconnects when using mocktime (Michael Mallan)
b630d46 func test: wait for block heights to match (Michael Mallan)
ada89c5 doc: update with electrum info (Michael Mallan)
177dfc4 lib: expose BDK's electrum client (Michael Mallan)
72c6314 ci: add electrs to func tests (jp1ac4)
371e31e func test: allow to run using electrs backend (jp1ac4)
a85d488 func test: allow for different bitcoin backends (jp1ac4)
1b04b29 func test: fix min rbf feerate (jp1ac4)
c7ee862 bitcoin: add electrum backend (jp1ac4)
c4c2424 bitcoin: expose MempoolEntryFees (jp1ac4)
5011ad9 bitcoin: return spent block height & time separately (jp1ac4)
689442c bitcoin: allow to store UTXO deriv index (jp1ac4)
4c02b0d bitcoin: use mut ref for start_rescan (Michael Mallan)
69259c1 poller: sync wallet before checking updates (jp1ac4)
89e004d bitcoin: add sync_wallet method to interface (jp1ac4)
34b9a49 config: add general bitcoin backend option (jp1ac4)
e267f66 descriptors: allow to get underlying public key (jp1ac4)

Pull request description:

  This is to add the Electrum backend as part of #56 (comment).

  This requires the database to be running version 5 following #1180. The migration from a previous DB version must be done using bitcoind. Thereafter, the daemon can be run using an Electrum backend by replacing the `[bitcoind_config]` section in the daemon.toml config file with:
  ```
  [electrum_config]
  addr = "127.0.0.1:50001" # adjust IP:port as required
  ```
  Remaining tasks:

  - [x] Include ancestors and descendants when getting a transaction's `MempoolEntry`
  - [ ] Additional sanity checks, e.g. check Electrum version
  - [x] Check if logic regarding ongoing rescan needs to be adjusted
  - [x] Add Electrum backend to functional tests
  - [x] Add Electrum backend to CI pipline functional tests
  - [ ] Add unit tests
  - [x] Update README & other docs

ACKs for top commit:
  darosior:
    re-ACK 341f940

Tree-SHA512: dbbb375123cc5c566f5c8535d002ac4491b4be5ab2766845b5b7ab51d19e7e85eafc0097235e1ebc5c5a049bd2222ab5582264314e46c77b5fff8027da31b803
  • Loading branch information
darosior committed Sep 5, 2024
2 parents 6826aa0 + 341f940 commit 6f73347
Show file tree
Hide file tree
Showing 28 changed files with 2,009 additions and 147 deletions.
32 changes: 32 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,47 @@ task:
- USE_MIN_BITCOIN_VERSION: 'TRUE'
- USE_MIN_BITCOIN_VERSION: 'FALSE'
- USE_TAPROOT: 1
BITCOIN_BACKEND_TYPE: 'bitcoind'
- USE_TAPROOT: 1
BITCOIN_BACKEND_TYPE: 'electrs'
- USE_TAPROOT: 0
BITCOIN_BACKEND_TYPE: 'electrs'
- name: 'RPC functional tests'
env:
TEST_GROUP: tests/test_rpc.py
matrix:
- USE_TAPROOT: 0
BITCOIN_BACKEND_TYPE: 'bitcoind'
- USE_TAPROOT: 1
BITCOIN_BACKEND_TYPE: 'bitcoind'
- USE_TAPROOT: 0
BITCOIN_BACKEND_TYPE: 'electrs'
- USE_TAPROOT: 1
BITCOIN_BACKEND_TYPE: 'electrs'
- name: 'Chain functional tests'
env:
TEST_GROUP: tests/test_chain.py
matrix:
- USE_TAPROOT: 0
BITCOIN_BACKEND_TYPE: 'bitcoind'
- USE_TAPROOT: 1
BITCOIN_BACKEND_TYPE: 'bitcoind'
- USE_TAPROOT: 0
BITCOIN_BACKEND_TYPE: 'electrs'
- USE_TAPROOT: 1
BITCOIN_BACKEND_TYPE: 'electrs'
- name: 'Spend functional tests'
env:
TEST_GROUP: tests/test_spend.py
matrix:
- USE_TAPROOT: 0
BITCOIN_BACKEND_TYPE: 'bitcoind'
- USE_TAPROOT: 1
BITCOIN_BACKEND_TYPE: 'bitcoind'
- USE_TAPROOT: 0
BITCOIN_BACKEND_TYPE: 'electrs'
- USE_TAPROOT: 1
BITCOIN_BACKEND_TYPE: 'electrs'

cargo_registry_cache:
folders: $CARGO_HOME/registry
Expand Down Expand Up @@ -63,6 +86,7 @@ task:
test_script: |
set -xe
# We always need bitcoind, even when using a different backend.
if [ "$USE_MIN_BITCOIN_VERSION" = "TRUE" ]; then
# Download the minimum required bitcoind binary
curl -O https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-linux-gnu.tar.gz
Expand All @@ -78,6 +102,14 @@ task:
export BITCOIND_PATH=bitcoin-26.0/bin/bitcoind
fi
if [ "$BITCOIN_BACKEND_TYPE" = "electrs" ]; then
curl -OL https://github.com/RCasatta/electrsd/releases/download/electrs_releases/electrs_linux_v0.9.11.zip
echo "2b2f8aef35cd8e16e109b948a903d010aa472f6cdf2147d47e01fd95cd1785da electrs_linux_v0.9.11.zip" | sha256sum -c
unzip electrs_linux_v0.9.11.zip
chmod 754 electrs
export ELECTRS_PATH=$PWD/electrs
fi
# The misc tests have a backward compat test that need the path to a previous version of Liana.
# For now it requires using 0.3.
if [ "$TEST_GROUP" = "tests/test_misc.py" ]; then
Expand Down
Loading

0 comments on commit 6f73347

Please sign in to comment.