Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ jobs:
uses: actions/cache@v5
with:
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
key: electrs-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind/electrs
if: "(steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
key: electrs-submit-package-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind
if: "steps.cache-bitcoind.outputs.cache-hit != 'true'"
run: |
source ./scripts/download_bitcoind_electrs.sh
source ./scripts/download_bitcoind.sh
mkdir -p bin
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
- name: Download electrs
if: "steps.cache-electrs.outputs.cache-hit != 'true'"
run: |
source ./scripts/build_electrs.sh
mkdir -p bin
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
- name: Set bitcoind/electrs environment variables
run: |
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/hrn-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@ jobs:
uses: actions/cache@v4
with:
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
key: electrs-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind/electrs
if: "steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true'"
key: electrs-submit-package-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind
if: "steps.cache-bitcoind.outputs.cache-hit != 'true'"
run: |
source ./scripts/download_bitcoind_electrs.sh
source ./scripts/download_bitcoind.sh
mkdir -p bin
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
- name: Download electrs
if: "steps.cache-electrs.outputs.cache-hit != 'true'"
run: |
source ./scripts/build_electrs.sh
mkdir -p bin
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
- name: Set bitcoind/electrs environment variables
run: |
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,18 @@ jobs:
uses: actions/cache@v5
with:
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
key: electrs-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind/electrs
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
key: electrs-submit-package-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind
if: "matrix.platform != 'windows-latest' && steps.cache-bitcoind.outputs.cache-hit != 'true'"
run: |
source ./scripts/download_bitcoind_electrs.sh
source ./scripts/download_bitcoind.sh
mkdir -p bin
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
- name: Download electrs
if: "matrix.platform != 'windows-latest' && steps.cache-electrs.outputs.cache-hit != 'true'"
run: |
source ./scripts/build_electrs.sh
mkdir -p bin
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
- name: Set bitcoind/electrs environment variables
run: |
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/vss-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ jobs:
--health-retries 5

steps:
- name: Enable caching for electrs
id: cache-electrs
uses: actions/cache@v5
with:
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
key: electrs-submit-package-${{ runner.os }}-${{ runner.arch }}
- name: Download electrs
if: "steps.cache-electrs.outputs.cache-hit != 'true'"
run: |
source ./scripts/build_electrs.sh
mkdir -p bin
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
- name: Set electrs environment variable
run: |
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
- name: Checkout code
uses: actions/checkout@v6
with:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/vss-no-auth-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ jobs:
--health-retries 5

steps:
- name: Enable caching for electrs
id: cache-electrs
uses: actions/cache@v5
with:
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
key: electrs-submit-package-${{ runner.os }}-${{ runner.arch }}
- name: Download electrs
if: "steps.cache-electrs.outputs.cache-hit != 'true'"
run: |
source ./scripts/build_electrs.sh
mkdir -p bin
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
- name: Set electrs environment variable
run: |
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
- name: Checkout code
uses: actions/checkout@v6
with:
Expand Down
27 changes: 27 additions & 0 deletions scripts/build_electrs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -eox pipefail

# Our Esplora-based tests require `electrs` binaries. Here, we
# download the code, build the binaries, and export their location
# via `ELECTRS_EXE`/`BITCOIND_EXE` which will be used by the
# `electrsd`/`bitcoind` crates in our tests.

HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')"
ELECTRS_GIT_REPO="https://github.com/tankyleo/blockstream-electrs.git"
ELECTRS_TAG="2026-05-26-electrum-submit-package"
if [[ "$HOST_PLATFORM" != *linux* && "$HOST_PLATFORM" != *darwin* ]]; then
printf "\n\n"
echo "Unsupported platform: $HOST_PLATFORM Exiting.."
exit 1
fi

DL_TMP_DIR=$(mktemp -d)
trap 'rm -rf -- "$DL_TMP_DIR"' EXIT

pushd "$DL_TMP_DIR"
git clone --branch $ELECTRS_TAG --depth 1 $ELECTRS_GIT_REPO blockstream-electrs
cd blockstream-electrs
RUSTFLAGS="" cargo build
export ELECTRS_EXE="$DL_TMP_DIR"/blockstream-electrs/target/debug/electrs
chmod +x "$ELECTRS_EXE"
popd
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
#!/bin/bash
set -eox pipefail

# Our Esplora-based tests require `electrs` and `bitcoind`
# binaries. Here, we download the binaries, validate them, and export their
# location via `ELECTRS_EXE`/`BITCOIND_EXE` which will be used by the
# Our Esplora-based tests require `bitcoind` binaries. Here, we
# download the binaries, validate them, and export their location
# via `ELECTRS_EXE`/`BITCOIND_EXE` which will be used by the
# `electrsd`/`bitcoind` crates in our tests.

HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')"
ELECTRS_DL_ENDPOINT="https://github.com/RCasatta/electrsd/releases/download/electrs_releases"
ELECTRS_VERSION="esplora_a33e97e1a1fc63fa9c20a116bb92579bbf43b254"
BITCOIND_DL_ENDPOINT="https://bitcoincore.org/bin/"
BITCOIND_VERSION="29.0"
if [[ "$HOST_PLATFORM" == *linux* ]]; then
ELECTRS_DL_FILE_NAME=electrs_linux_"$ELECTRS_VERSION".zip
ELECTRS_DL_HASH="865e26a96e8df77df01d96f2f569dcf9622fc87a8d99a9b8fe30861a4db9ddf1"
BITCOIND_DL_FILE_NAME=bitcoin-"$BITCOIND_VERSION"-x86_64-linux-gnu.tar.gz
BITCOIND_DL_HASH="a681e4f6ce524c338a105f214613605bac6c33d58c31dc5135bbc02bc458bb6c"
elif [[ "$HOST_PLATFORM" == *darwin* ]]; then
ELECTRS_DL_FILE_NAME=electrs_macos_"$ELECTRS_VERSION".zip
ELECTRS_DL_HASH="2d5ff149e8a2482d3658e9b386830dfc40c8fbd7c175ca7cbac58240a9505bcd"
BITCOIND_DL_FILE_NAME=bitcoin-"$BITCOIND_VERSION"-x86_64-apple-darwin.tar.gz
BITCOIND_DL_HASH="5bb824fc86a15318d6a83a1b821ff4cd4b3d3d0e1ec3d162b805ccf7cae6fca8"
else
Expand All @@ -31,13 +25,6 @@ DL_TMP_DIR=$(mktemp -d)
trap 'rm -rf -- "$DL_TMP_DIR"' EXIT

pushd "$DL_TMP_DIR"
ELECTRS_DL_URL="$ELECTRS_DL_ENDPOINT"/"$ELECTRS_DL_FILE_NAME"
curl -L -o "$ELECTRS_DL_FILE_NAME" "$ELECTRS_DL_URL"
echo "$ELECTRS_DL_HASH $ELECTRS_DL_FILE_NAME"|shasum -a 256 -c
unzip "$ELECTRS_DL_FILE_NAME"
export ELECTRS_EXE="$DL_TMP_DIR"/electrs
chmod +x "$ELECTRS_EXE"

BITCOIND_DL_URL="$BITCOIND_DL_ENDPOINT"/bitcoin-core-"$BITCOIND_VERSION"/"$BITCOIND_DL_FILE_NAME"
curl -L -o "$BITCOIND_DL_FILE_NAME" "$BITCOIND_DL_URL"
echo "$BITCOIND_DL_HASH $BITCOIND_DL_FILE_NAME"|shasum -a 256 -c
Expand Down
122 changes: 67 additions & 55 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,18 +1337,22 @@ fn build_with_store_internal(
let (chain_source, chain_tip_opt) = match chain_data_source_config {
Some(ChainDataSourceConfig::Esplora { server_url, headers, sync_config }) => {
let sync_config = sync_config.unwrap_or(EsploraSyncConfig::default());
ChainSource::new_esplora(
server_url.clone(),
headers.clone(),
sync_config,
Arc::clone(&fee_estimator),
Arc::clone(&tx_broadcaster),
Arc::clone(&kv_store),
Arc::clone(&config),
Arc::clone(&logger),
Arc::clone(&node_metrics),
)
.map_err(|()| BuildError::ChainSourceSetupFailed)?
runtime
.block_on(async {
ChainSource::new_esplora(
server_url.clone(),
headers.clone(),
sync_config,
Arc::clone(&fee_estimator),
Arc::clone(&tx_broadcaster),
Arc::clone(&kv_store),
Arc::clone(&config),
Arc::clone(&logger),
Arc::clone(&node_metrics),
)
.await
})
.map_err(|()| BuildError::ChainSourceSetupFailed)?
},
Some(ChainDataSourceConfig::Electrum { server_url, sync_config }) => {
let sync_config = sync_config.unwrap_or(ElectrumSyncConfig::default());
Expand All @@ -1370,55 +1374,63 @@ fn build_with_store_internal(
rpc_password,
rest_client_config,
}) => match rest_client_config {
Some(rest_client_config) => runtime.block_on(async {
ChainSource::new_bitcoind_rest(
rpc_host.clone(),
*rpc_port,
rpc_user.clone(),
rpc_password.clone(),
Arc::clone(&fee_estimator),
Arc::clone(&tx_broadcaster),
Arc::clone(&kv_store),
Arc::clone(&config),
rest_client_config.clone(),
Arc::clone(&logger),
Arc::clone(&node_metrics),
)
.await
}),
None => runtime.block_on(async {
ChainSource::new_bitcoind_rpc(
rpc_host.clone(),
*rpc_port,
rpc_user.clone(),
rpc_password.clone(),
Arc::clone(&fee_estimator),
Arc::clone(&tx_broadcaster),
Arc::clone(&kv_store),
Arc::clone(&config),
Arc::clone(&logger),
Arc::clone(&node_metrics),
)
.await
}),
Some(rest_client_config) => runtime
.block_on(async {
ChainSource::new_bitcoind_rest(
rpc_host.clone(),
*rpc_port,
rpc_user.clone(),
rpc_password.clone(),
Arc::clone(&fee_estimator),
Arc::clone(&tx_broadcaster),
Arc::clone(&kv_store),
Arc::clone(&config),
rest_client_config.clone(),
Arc::clone(&logger),
Arc::clone(&node_metrics),
)
.await
})
.map_err(|()| BuildError::ChainSourceSetupFailed)?,
None => runtime
.block_on(async {
ChainSource::new_bitcoind_rpc(
rpc_host.clone(),
*rpc_port,
rpc_user.clone(),
rpc_password.clone(),
Arc::clone(&fee_estimator),
Arc::clone(&tx_broadcaster),
Arc::clone(&kv_store),
Arc::clone(&config),
Arc::clone(&logger),
Arc::clone(&node_metrics),
)
.await
})
.map_err(|()| BuildError::ChainSourceSetupFailed)?,
},

None => {
// Default to Esplora client.
let server_url = DEFAULT_ESPLORA_SERVER_URL.to_string();
let sync_config = EsploraSyncConfig::default();
ChainSource::new_esplora(
server_url.clone(),
HashMap::new(),
sync_config,
Arc::clone(&fee_estimator),
Arc::clone(&tx_broadcaster),
Arc::clone(&kv_store),
Arc::clone(&config),
Arc::clone(&logger),
Arc::clone(&node_metrics),
)
.map_err(|()| BuildError::ChainSourceSetupFailed)?
runtime
.block_on(async {
ChainSource::new_esplora(
server_url.clone(),
HashMap::new(),
sync_config,
Arc::clone(&fee_estimator),
Arc::clone(&tx_broadcaster),
Arc::clone(&kv_store),
Arc::clone(&config),
Arc::clone(&logger),
Arc::clone(&node_metrics),
)
.await
})
.map_err(|()| BuildError::ChainSourceSetupFailed)?
},
};
let chain_source = Arc::new(chain_source);
Expand Down
Loading
Loading