feat(txpool): Make TransactionPool trait object safe (#4156)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
PatStiles
2023-08-11 08:34:56 -05:00
committed by GitHub
parent 03fc87701a
commit 427a8395f9
7 changed files with 19 additions and 28 deletions

View File

@ -204,7 +204,7 @@ where
/// complete transaction object if it is unknown to them. The dissemination of complete
/// transactions to a fraction of peers usually ensures that all nodes receive the transaction
/// and won't need to request it.
fn on_new_transactions(&mut self, hashes: impl IntoIterator<Item = TxHash>) {
fn on_new_transactions(&mut self, hashes: Vec<TxHash>) {
// Nothing to propagate while initially syncing
if self.network.is_initially_syncing() {
return
@ -372,9 +372,7 @@ where
/// Handles a command received from a detached [`TransactionsHandle`]
fn on_command(&mut self, cmd: TransactionsCommand) {
match cmd {
TransactionsCommand::PropagateHash(hash) => {
self.on_new_transactions(std::iter::once(hash))
}
TransactionsCommand::PropagateHash(hash) => self.on_new_transactions(vec![hash]),
}
}