Skip to content

Commit

Permalink
ci: electrs pinned to esplora_a33e97e1
Browse files Browse the repository at this point in the history
  • Loading branch information
realeinherjar committed Oct 18, 2023
1 parent 905cf3f commit 8afcc28
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
20 changes: 0 additions & 20 deletions crates/esplora/tests/async_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,3 @@ pub async fn test_update_tx_graph_without_keychain() -> anyhow::Result<()> {
assert_eq!(graph_update_txids, expected_txids);
Ok(())
}
#[test]
fn simple_test() -> anyhow::Result<()> {
let bitcoind_exe =
bitcoind::exe_path().expect("Cannot find bitcoind daemon, set BITCOIND_EXEC environment variable with the path to bitcoind");
let mut bitcoind_conf = bitcoind::Conf::default();
bitcoind_conf.p2p = bitcoind::P2P::Yes;
let bitcoind = BitcoinD::with_conf(&bitcoind_exe, &bitcoind_conf)?;

let mut electrs_conf = Conf::default();
electrs_conf.http_enabled = true;
let electrs_exe = electrsd::exe_path().expect("Cannot find electrs daemon, set ELECTRS_EXEC environment variable with the path to electrs");
let electrsd = ElectrsD::with_conf(&electrs_exe, &bitcoind, &electrs_conf)?;

// Alive checks
let _ = bitcoind.client.ping().unwrap(); // without using bitcoind, it is dropped and all the rest fails.
let _ = electrsd.client.ping().unwrap();
assert!(bitcoind.client.ping().is_ok());
assert!(electrsd.client.ping().is_ok());
Ok(())
}
46 changes: 37 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,45 @@
let
overlays = [ (import rust-overlay) ];
lib = pkgs.lib;
stdenv = pkgs.stdenv;
isDarwin = stdenv.isDarwin;
libsDarwin = with pkgs.darwin.apple_sdk.frameworks; [
# Additional darwin specific inputs can be set here
Security
SystemConfiguration
CoreServices
];

pkgs = import nixpkgs {
inherit system overlays;
};
pkgs-bitcoind = import nixpkgs-bitcoind {
inherit system overlays;
};
# pin electrs to a specific version
# pinned to esplora_a33e97e1
electrs_base_url = "https://github.com/RCasatta/electrsd/releases/download/electrs_releases/";
electrs_url =
if isDarwin then
electrs_base_url + "electrs_macos_esplora_a33e97e1a1fc63fa9c20a116bb92579bbf43b254.zip"
else
electrs_base_url + "electrs_linux_esplora_a33e97e1a1fc63fa9c20a116bb92579bbf43b254.zip";
electrs_hash =
if isDarwin then
"sha256-xfkllY8ovVih469hJuw+GTcf2kZ0g0JAK8diEh5FFsw="
else
lib.fakeHash;
electrs = stdenv.mkDerivation {
name = "electrs";
src = pkgs.fetchzip {
url = electrs_url;
hash = electrs_hash;
};
installPhase = ''
mkdir -p $out/bin
cp electrs $out/bin
'';
};

# Toolchains
# latest stable
Expand Down Expand Up @@ -67,18 +100,13 @@
buildInputs = [
# Add additional build inputs here
pkgs-bitcoind.bitcoind
pkgs.electrs
electrs
pkgs.openssl
pkgs.openssl.dev
pkgs.pkg-config
pkgs.curl
pkgs.libiconv
] ++ lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
pkgs.darwin.apple_sdk.frameworks.CoreServices
];
] ++ lib.optionals isDarwin libsDarwin;

# WASM deps
wasmInputs = [
Expand All @@ -89,7 +117,7 @@
nativeBuildInputs = [
# Add additional build inputs here
pkgs.python3
] ++ lib.optionals pkgs.stdenv.isDarwin [
] ++ lib.optionals isDarwin [
# Additional darwin specific native inputs can be set here
];

Expand Down Expand Up @@ -118,7 +146,7 @@
inherit nativeBuildInputs;
# Additional environment variables can be set directly
BITCOIND_EXEC = "${pkgs.bitcoind}/bin/bitcoind";
ELECTRS_EXEC = "${pkgs.electrs}/bin/electrs";
ELECTRS_EXEC = "${electrs}/bin/electrs";
};

# MSRV derivation arguments
Expand Down

0 comments on commit 8afcc28

Please sign in to comment.