Skip to content

Commit

Permalink
Merge pull request stellar#3666 from jayz22/storage-interface
Browse files Browse the repository at this point in the history
Adapt `SnapshotSource` interface

Reviewed-by: sisuresh
  • Loading branch information
latobarita authored Mar 6, 2023
2 parents 7b0f492 + af12bcb commit f94d660
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ rustc-simple-version = "0.1.0"
[dependencies.soroban-env-host]
version = "0.0.14"
git = "https://github.com/stellar/rs-soroban-env"
rev = "d06aaddca61f011cc64ec098b464233423197c3a"
rev = "5695440da452837555d8f7f259cc33341fdf07b0"
features = ["vm"]

[dependencies.soroban-test-wasms]
git = "https://github.com/stellar/rs-soroban-env"
rev = "d06aaddca61f011cc64ec098b464233423197c3a"
rev = "5695440da452837555d8f7f259cc33341fdf07b0"
10 changes: 5 additions & 5 deletions src/rust/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,14 @@ impl Pfc {
}

impl SnapshotSource for Pfc {
fn get(&self, key: &LedgerKey) -> Result<LedgerEntry, HostError> {
let kv = xdr_to_vec_u8(key)?;
fn get(&self, key: &Rc<LedgerKey>) -> Result<Rc<LedgerEntry>, HostError> {
let kv = xdr_to_vec_u8(key.as_ref())?;
let lev = self.with_cb(|cb| cb.get_ledger_entry(&kv))?;
xdr_from_cxx_buf(&lev)
xdr_from_cxx_buf(&lev).map(|le| Rc::new(le))
}

fn has(&self, key: &LedgerKey) -> Result<bool, HostError> {
let kv = xdr_to_vec_u8(key)?;
fn has(&self, key: &Rc<LedgerKey>) -> Result<bool, HostError> {
let kv = xdr_to_vec_u8(key.as_ref())?;
self.with_cb(|cb| cb.has_ledger_entry(&kv))
}
}
Expand Down

0 comments on commit f94d660

Please sign in to comment.