-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle txpool message collisions (#524)
- Loading branch information
Showing
8 changed files
with
525 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
use crate::database::{columns, Database, KvStoreError}; | ||
use fuel_core_interfaces::{ | ||
common::{fuel_storage::Storage, fuel_types::Bytes32}, | ||
common::{fuel_storage::Storage, fuel_types::MessageId}, | ||
model::DaMessage, | ||
}; | ||
use std::borrow::Cow; | ||
|
||
impl Storage<Bytes32, DaMessage> for Database { | ||
impl Storage<MessageId, DaMessage> for Database { | ||
type Error = KvStoreError; | ||
|
||
fn insert( | ||
&mut self, | ||
key: &Bytes32, | ||
key: &MessageId, | ||
value: &DaMessage, | ||
) -> Result<Option<DaMessage>, KvStoreError> { | ||
Database::insert(self, key.as_ref(), columns::DA_MESSAGES, value.clone()) | ||
.map_err(Into::into) | ||
} | ||
|
||
fn remove(&mut self, key: &Bytes32) -> Result<Option<DaMessage>, KvStoreError> { | ||
fn remove(&mut self, key: &MessageId) -> Result<Option<DaMessage>, KvStoreError> { | ||
Database::remove(self, key.as_ref(), columns::DA_MESSAGES).map_err(Into::into) | ||
} | ||
|
||
fn get(&self, key: &Bytes32) -> Result<Option<Cow<DaMessage>>, KvStoreError> { | ||
fn get(&self, key: &MessageId) -> Result<Option<Cow<DaMessage>>, KvStoreError> { | ||
Database::get(self, key.as_ref(), columns::DA_MESSAGES).map_err(Into::into) | ||
} | ||
|
||
fn contains_key(&self, key: &Bytes32) -> Result<bool, KvStoreError> { | ||
fn contains_key(&self, key: &MessageId) -> Result<bool, KvStoreError> { | ||
Database::exists(self, key.as_ref(), columns::DA_MESSAGES).map_err(Into::into) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.