Skip to content

Commit

Permalink
Introduce blob_bytes function
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-ds committed Oct 14, 2024
1 parent 07bc3cf commit dccbffc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions linera-base/src/data_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,11 @@ impl BlobContent {
}
.clone()
}

/// Gets the `BlobBytes` for this `BlobContent`.
pub fn blob_bytes(&self) -> BlobBytes {
BlobBytes(self.inner_bytes())
}
}

impl From<Blob> for BlobContent {
Expand Down
4 changes: 2 additions & 2 deletions linera-base/src/identifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
use crate::{
bcs_scalar,
crypto::{BcsHashable, CryptoError, CryptoHash, PublicKey},
data_types::{BlobBytes, BlobContent, BlockHeight},
data_types::{BlobContent, BlockHeight},
doc_scalar,
};

Expand Down Expand Up @@ -228,7 +228,7 @@ impl BlobId {
/// Creates a new `BlobId` from a `BlobContent`
pub fn from_content(content: &BlobContent) -> Self {
Self {
hash: CryptoHash::new(&BlobBytes(content.inner_bytes())),
hash: CryptoHash::new(&content.blob_bytes()),
blob_type: content.into(),
}
}
Expand Down

0 comments on commit dccbffc

Please sign in to comment.