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

fix: correct default impls to not bound T #1490

Merged
merged 1 commit into from
Oct 16, 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
16 changes: 14 additions & 2 deletions crates/rpc-types-txpool/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,20 @@ impl Serialize for TxpoolInspectSummary {
/// as the ones that are being scheduled for future execution only.
///
/// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_content) for more details
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct TxpoolContent<T = Transaction> {
/// pending tx
pub pending: BTreeMap<Address, BTreeMap<String, T>>,
/// queued tx
pub queued: BTreeMap<Address, BTreeMap<String, T>>,
}

impl<T> Default for TxpoolContent<T> {
fn default() -> Self {
Self { pending: BTreeMap::new(), queued: BTreeMap::new() }
}
}

impl<T> TxpoolContent<T> {
/// Removes the transactions from the given sender
pub fn remove_from(&mut self, sender: &Address) -> TxpoolContentFrom<T> {
Expand All @@ -133,14 +139,20 @@ impl<T> TxpoolContent<T> {
/// Same as [TxpoolContent] but for a specific address.
///
/// See [here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_contentFrom) for more details
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct TxpoolContentFrom<T = Transaction> {
/// pending tx
pub pending: BTreeMap<String, T>,
/// queued tx
pub queued: BTreeMap<String, T>,
}

impl<T> Default for TxpoolContentFrom<T> {
fn default() -> Self {
Self { pending: BTreeMap::new(), queued: BTreeMap::new() }
}
}

/// Transaction Pool Inspect
///
/// The inspect inspection property can be queried to list a textual summary
Expand Down