Skip to content

Commit 7830a16

Browse files
committed
Isolate testing of 0FC channels to standalone CI
The electrsd dev-dependency does not yet ship binaries that support submitpackage on electrum, so we do not turn on 0FC channels in local tests, and instead only turn them on in a standalone CI workflow, which includes a custom electrs server that adds support for submitpackage on electrum. Co-Authored-By: HAL 9000
1 parent 9ce31a5 commit 7830a16

3 files changed

Lines changed: 54 additions & 4 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI Checks - 0FC Integration Tests
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build-and-test:
11+
timeout-minutes: 60
12+
runs-on: self-hosted
13+
steps:
14+
- name: Checkout source code
15+
uses: actions/checkout@v4
16+
- name: Install Rust stable toolchain
17+
run: |
18+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain stable
19+
- name: Enable caching for bitcoind
20+
id: cache-bitcoind
21+
uses: actions/cache@v4
22+
with:
23+
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
24+
key: bitcoind-29.0-${{ runner.os }}-${{ runner.arch }}
25+
- name: Enable caching for electrs
26+
id: cache-electrs
27+
uses: actions/cache@v4
28+
with:
29+
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
30+
key: electrs-submit-package-${{ runner.os }}-${{ runner.arch }}
31+
- name: Download bitcoind
32+
if: "steps.cache-bitcoind.outputs.cache-hit != 'true'"
33+
run: |
34+
source ./scripts/download_bitcoind.sh
35+
mkdir -p bin
36+
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
37+
- name: Download electrs
38+
if: "steps.cache-electrs.outputs.cache-hit != 'true'"
39+
run: |
40+
source ./scripts/build_electrs.sh
41+
mkdir -p bin
42+
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
43+
- name: Set bitcoind/electrs environment variables
44+
run: |
45+
echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
46+
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
47+
- name: Test with 0FC enabled
48+
run: |
49+
RUSTFLAGS="--cfg no_download --cfg cycle_tests --cfg tokio_unstable --cfg zero_fee_commitment_tests" cargo test

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ check-cfg = [
135135
"cfg(eclair_test)",
136136
"cfg(cycle_tests)",
137137
"cfg(hrn_tests)",
138+
"cfg(zero_fee_commitment_tests)",
138139
]
139140

140141
[[bench]]

tests/common/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,10 @@ pub(crate) fn random_node_alias() -> Option<NodeAlias> {
382382
pub(crate) fn random_config() -> TestConfig {
383383
let mut node_config = Config::default();
384384

385-
// We want 0FC channels to be negotiated half the time, 0.49 is good enough
386-
let zero_fee_commitments = rand::random_bool(0.7);
387-
println!("Negotiating zero-fee commitment channels: {}", zero_fee_commitments);
388-
node_config.anchor_channels_config.enable_zero_fee_commitments = zero_fee_commitments;
385+
#[cfg(zero_fee_commitment_tests)]
386+
{
387+
node_config.anchor_channels_config.enable_zero_fee_commitments = true;
388+
}
389389

390390
node_config.network = Network::Regtest;
391391
println!("Setting network: {}", node_config.network);

0 commit comments

Comments
 (0)