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

chore: don't into() Cid codec in message store #80

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all 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
4 changes: 2 additions & 2 deletions crates/dwn-rs-stores/src/surrealdb/message_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl MessageStore for SurrealDB {

let i = serde_ipld_dagcbor::to_vec(&message)?;
let mh = Code::Sha2_256.digest(i.as_slice());
let cid = Cid::new_v1(multicodec::Codec::DagCbor.code().into(), mh);
let cid = Cid::new_v1(multicodec::Codec::DagCbor.code(), mh);

self.as_tenant(tenant, |db| async move {
db.create::<Option<GetEncodedMessage>>((MESSAGES_TABLE, Id::String(cid.to_string())))
Expand Down Expand Up @@ -121,7 +121,7 @@ impl MessageStore for SurrealDB {
.map(|m: GetEncodedMessage| {
let cid = Cid::from_str(m.cid.as_str())?;
let mh = Code::Sha2_256.digest(&m.encoded_message);
let data_cid = Cid::new_v1(multicodec::Codec::DagCbor.code().into(), mh);
let data_cid = Cid::new_v1(multicodec::Codec::DagCbor.code(), mh);

if cid != data_cid {
return Err(MessageStoreError::StoreError(StoreError::NotFound));
Expand Down
Loading