Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
strategy:
fail-fast: false
matrix:
toolchain: [ nightly, beta, stable, 1.66.0 ]
toolchain: [ nightly, beta, stable, 1.67.0 ]
steps:
- uses: actions/checkout@v3
- name: Install rust ${{ matrix.toolchain }}
Expand Down
40 changes: 21 additions & 19 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ default-members = [
authors = ["Dr Maxim Orlovsky <[email protected]>"]
homepage = "https://github.com/RGB-WG"
repository = "https://github.com/RGB-WG/rgb"
rust-version = "1.66" # Due to strict encoding library (caused by GAD)
rust-version = "1.67" # Due to strict encoding library
edition = "2021"
license = "Apache-2.0"

[workspace.dependencies]
amplify = "4.0.0"
baid58 = "0.3.1"
strict_encoding = "2.4.1"
strict_types = "1.4.1"
strict_encoding = "2.5.0"
strict_types = "1.5.0"
rgb-std = { version = "0.10.2", features = ["fs"] }
rgb-wallet = { version = "0.10.2", features = ["fs"] }

Expand Down Expand Up @@ -50,8 +50,8 @@ required-features = ["cli"]
amplify = { workspace = true }
baid58 = { workspace = true }
strict_types = { workspace = true, features = ["serde"] }
commit_verify = "0.10.2"
bp-core = { version = "0.10.3", features = ["serde"] }
commit_verify = "0.10.4"
bp-core = { version = "0.10.5", features = ["serde"] }
rgb-std = { workspace = true }
rgb-wallet = { workspace = true }
rgb-persist-fs = { version = "0.10.0", path = "fs" }
Expand All @@ -74,6 +74,6 @@ cli = ["clap", "shellexpand", "log", "electrum"]
features = [ "all" ]

[patch.crates-io]
rgb-core = { git = "https://github.com/RGB-WG/rgb-core" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-wallet" }
rgb-wallet = { git = "https://github.com/RGB-WG/rgb-wallet" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "resoler" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-wallet", branch = "develop" }
rgb-wallet = { git = "https://github.com/RGB-WG/rgb-wallet", branch = "develop" }
2 changes: 1 addition & 1 deletion MANIFEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Binary
Kind: Free software
License: Apache-2.0
Language: Rust
Compiler: 1.66
Compiler: 1.67
Author: Maxim Orlovsky
Maintained: LNP/BP Standards Association, Switzerland
Maintainers:
Expand Down
23 changes: 14 additions & 9 deletions src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ mod _electrum {
use bitcoin::{Script, ScriptBuf};
use bp::{Chain, LockTime, SeqNo, Tx, TxIn, TxOut, TxVer, VarIntArray, Witness};
use electrum_client::{ElectrumApi, Error, ListUnspentRes};
use rgbstd::contract::WitnessOrd;
use rgbstd::resolvers::ResolveHeight;
use rgbstd::validation::{ResolveTx, TxResolverError};

Expand Down Expand Up @@ -179,16 +180,17 @@ mod _electrum {

impl ResolveHeight for BlockchainResolver {
type Error = TxResolverError;
fn resolve_height(&mut self, txid: Txid) -> Result<u32, Self::Error> {
let resp = self
fn resolve_height(&mut self, txid: Txid) -> Result<WitnessOrd, Self::Error> {
let tx = match self
.0
.transaction_get(&bitcoin::Txid::from_byte_array(txid.to_raw_array()))
.map_err(|err| match err {
Error::Message(_) | Error::Protocol(_) => TxResolverError::Unknown(txid),
err => TxResolverError::Other(txid, err.to_string()),
})?;
{
Ok(tx) => tx,
Err(Error::Message(_) | Error::Protocol(_)) => return Ok(WitnessOrd::OffChain),
Err(err) => return Err(TxResolverError::Other(txid, err.to_string())),
};

let scripts: Vec<&Script> = resp
let scripts: Vec<&Script> = tx
.output
.iter()
.map(|out| out.script_pubkey.as_script())
Expand All @@ -208,8 +210,11 @@ mod _electrum {
.map(|h| (h.tx_hash, if h.height > 0 { h.height as u32 } else { 0 }))
.collect();

let min_height = transactions.into_values().min();
let min_height = min_height.unwrap_or_default();
let min_height = transactions
.into_values()
.min()
.map(WitnessOrd::from_electrum_height)
.unwrap_or(WitnessOrd::OffChain);

Ok(min_height)
}
Expand Down