Skip to content
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
22 changes: 11 additions & 11 deletions crates/rpc/rpc/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ where
inspect: &mut BTreeMap<Address, BTreeMap<String, TxpoolInspectSummary>>,
) {
let entry = inspect.entry(tx.sender()).or_default();
let key = tx.nonce().to_string();
let tx = tx.to_recovered_transaction();
entry.insert(
key,
tx.nonce().to_string(),
TxpoolInspectSummary {
to: tx.to(),
value: tx.value(),
Expand All @@ -100,17 +99,18 @@ where
);
}

let mut inspect = TxpoolInspect::default();
let AllPoolTransactions { pending, queued } = self.pool.all_transactions();

for pending in pending {
insert(&pending.transaction, &mut inspect.pending);
}
for queued in queued {
insert(&queued.transaction, &mut inspect.queued);
}

Ok(inspect)
Ok(TxpoolInspect {
pending: pending.iter().fold(Default::default(), |mut acc, tx| {
insert(&tx.transaction, &mut acc);
acc
}),
queued: queued.iter().fold(Default::default(), |mut acc, tx| {
insert(&tx.transaction, &mut acc);
acc
}),
})
}

/// Retrieves the transactions contained within the txpool, returning pending as well as queued
Expand Down