Skip to content
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

Refactor/vault light #463

Merged
merged 13 commits into from
Apr 12, 2023
Merged
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export BITCOIN_RPC_URL=http://localhost:18443
export BITCOIN_RPC_USER=rpcuser
export BITCOIN_RPC_PASS=rpcpassword
export ELECTRS_URL=http://localhost:3002
11 changes: 4 additions & 7 deletions .github/workflows/cargo-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ jobs:
test:
name: Test Suite
runs-on: [self-hosted, linux]
services:
bitcoind:
image: docker.io/interlayhq/bitcoin-core:22.0
ports:
- 18443:18443

strategy:
matrix:
Expand Down Expand Up @@ -60,9 +55,11 @@ jobs:
env:
RUST_LOG: info,regalloc=warn
BITCOIN_RPC_URL: http://127.0.0.1:18443
BITCOIN_RPC_USER: user
BITCOIN_RPC_PASS: pass
BITCOIN_RPC_USER: rpcuser
BITCOIN_RPC_PASS: rpcpassword
ELECTRS_URL: http://localhost:3002
run: |
docker-compose up --detach
cargo test --release --workspace --features ${{ matrix.metadata }} --features uses-bitcoind
- name: build
run: |
Expand Down
16 changes: 1 addition & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ num-derive = "0.3"
futures = "0.3.5"
log = "0.4.0"
hyper = "0.10"
esplora-btc-api = "1.0.3"
sha2 = "0.8.2"
cfg-if = "1.0"

Expand All @@ -42,3 +41,4 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-
mockall = "0.8.1"
regex = "1.4.3"
rand = "0.7"
serial_test = "*"
8 changes: 7 additions & 1 deletion bitcoin/src/electrs/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bitcoincore_rpc::bitcoin::{
consensus::encode::Error as BitcoinEncodeError, hashes::hex::Error as HexError,
util::address::Error as BitcoinAddressError,
};
use reqwest::Error as ReqwestError;
use reqwest::{Error as ReqwestError, StatusCode};
use serde_json::Error as SerdeJsonError;
use std::num::{ParseIntError, TryFromIntError};
use thiserror::Error;
Expand Down Expand Up @@ -36,3 +36,9 @@ pub enum Error {
#[error("ParseIntError: {0}")]
ParseIntError(#[from] ParseIntError),
}

impl Error {
pub fn is_not_found(&self) -> bool {
matches!(self, Error::ReqwestError(err) if err.status().contains(&StatusCode::NOT_FOUND))
}
}
Loading