From 9313eda6ccbaef2a5f46d3ce8a9f993de7c1c632 Mon Sep 17 00:00:00 2001 From: Panagiotis Ganelis <50522617+PanGan21@users.noreply.github.com> Date: Tue, 18 Jul 2023 18:02:13 +0300 Subject: [PATCH] feat: add timestamp to pool update (#3833) --- crates/transaction-pool/src/maintain.rs | 2 ++ crates/transaction-pool/src/pool/mod.rs | 1 + crates/transaction-pool/src/traits.rs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/crates/transaction-pool/src/maintain.rs b/crates/transaction-pool/src/maintain.rs index e8b8a8f1ed..1b4084c0f3 100644 --- a/crates/transaction-pool/src/maintain.rs +++ b/crates/transaction-pool/src/maintain.rs @@ -266,6 +266,7 @@ pub async fn maintain_transaction_pool( changed_accounts, // all transactions mined in the new chain need to be removed from the pool mined_transactions: new_mined_transactions.into_iter().collect(), + timestamp: new_tip.timestamp, }; pool.on_canonical_state_change(update); @@ -331,6 +332,7 @@ pub async fn maintain_transaction_pool( pending_block_base_fee, changed_accounts, mined_transactions, + timestamp: tip.timestamp, }; pool.on_canonical_state_change(update); } diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index 2c055bf9f7..d3d3c5ca9a 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -257,6 +257,7 @@ where pending_block_base_fee, changed_accounts, mined_transactions, + timestamp: _, } = update; let changed_senders = self.changed_senders(changed_accounts.into_iter()); let block_info = BlockInfo { diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index 8b2110353d..d44c25f1b5 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -402,6 +402,8 @@ pub struct CanonicalStateUpdate { pub changed_accounts: Vec, /// All mined transactions in the block range. pub mined_transactions: Vec, + /// Timestamp of the latest chain update + pub timestamp: u64, } impl fmt::Display for CanonicalStateUpdate {