Skip to content

Commit

Permalink
Merge pull request #153 from tonlabs/0.25.4-rc
Browse files Browse the repository at this point in the history
### Fixed- `waitForTransaction` didn't use prev_alt_ref for block walking
  • Loading branch information
melsomino authored Aug 10, 2020
2 parents 422c971 + 0e78a9d commit 98c9774
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Release Notes
All notable changes to this project will be documented in this file.

## 0.25.4 Aug 5, 2020
### Fixed
- `waitForTransaction` didn't use prev_alt_ref for block walking

## 0.25.3 Jul 30, 2020
### New
- All methods that require contract's code/data can use field `boc`
Expand Down
2 changes: 1 addition & 1 deletion ton_client/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ton_client"
version = "0.25.3"
version = "0.25.4"
authors = ["Michael Vlasov"]
edition = "2018"
license = "Apache-2.0"
Expand Down
15 changes: 10 additions & 5 deletions ton_sdk/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl Block {
None)
.await
.map_err(|err| match err.downcast_ref::<SdkError>() {
Some(SdkError::WaitForTimeout) =>
Some(SdkError::WaitForTimeout) =>
SdkError::NotFound(format!(
"No blocks for workchain {} found", workchain)).into(),
_ => err
Expand Down Expand Up @@ -142,12 +142,12 @@ impl Block {
if shard_block.is_null() {
fail!(SdkError::NotFound(format!("No matching shard for account {}", address)));
}

shard_block["descr"]["root_hash"]
.as_str()
.map(|val| val.to_owned().into())
.ok_or(SdkError::InvalidData {
msg: "No `root_hash` field in shard descr".to_owned() }.into())
msg: "No `root_hash` field in shard descr".to_owned() }.into())
}
}
}
Expand All @@ -160,11 +160,16 @@ impl Block {
&json!({
"prev_ref": {
"root_hash": { "eq": current.to_string() }
},
"OR": {
"prev_alt_ref": {
"root_hash": { "eq": current.to_string() }
}
}
}).to_string(),
BLOCK_FIELDS,
timeout).await?;
debug!("{}: block recieved {:#}", crate::Contract::now(), block);
debug!("{}: block received {:#}", crate::Contract::now(), block);

if block["after_split"] == true && !Contract::check_shard_match(block.clone(), address)? {
client.wait_for(
Expand All @@ -183,4 +188,4 @@ impl Block {
serde_json::from_value(block).map_err(|err| err.into())
}
}
}
}

0 comments on commit 98c9774

Please sign in to comment.