diff --git a/api/src/context.rs b/api/src/context.rs index ffcd13c320f4e..030652028e9db 100644 --- a/api/src/context.rs +++ b/api/src/context.rs @@ -648,7 +648,9 @@ impl Context { .into_iter() .map(|t| { // Update the timestamp if the next block occurs - if let Some(txn) = t.transaction.try_as_block_metadata() { + if let Some(txn) = t.transaction.try_as_block_metadata_ext() { + timestamp = txn.timestamp_usecs(); + } else if let Some(txn) = t.transaction.try_as_block_metadata() { timestamp = txn.timestamp_usecs(); } let txn = converter.try_into_onchain_transaction(timestamp, t)?; diff --git a/crates/indexer/src/indexer/fetcher.rs b/crates/indexer/src/indexer/fetcher.rs index c565ddf516eab..780ec643353d6 100644 --- a/crates/indexer/src/indexer/fetcher.rs +++ b/crates/indexer/src/indexer/fetcher.rs @@ -252,7 +252,13 @@ async fn fetch_nexts( // Do not update block_height if first block is block metadata if ind > 0 { // Update the timestamp if the next block occurs - if let Some(txn) = raw_txn.transaction.try_as_block_metadata() { + if let Some(txn) = raw_txn.transaction.try_as_block_metadata_ext() { + timestamp = txn.timestamp_usecs(); + epoch = txn.epoch(); + epoch_bcs = aptos_api_types::U64::from(epoch); + block_height += 1; + block_height_bcs = aptos_api_types::U64::from(block_height); + } else if let Some(txn) = raw_txn.transaction.try_as_block_metadata() { timestamp = txn.timestamp_usecs(); epoch = txn.epoch(); epoch_bcs = aptos_api_types::U64::from(epoch); diff --git a/ecosystem/indexer-grpc/indexer-grpc-fullnode/src/stream_coordinator.rs b/ecosystem/indexer-grpc/indexer-grpc-fullnode/src/stream_coordinator.rs index c2e7fbd2135ba..804067037d918 100644 --- a/ecosystem/indexer-grpc/indexer-grpc-fullnode/src/stream_coordinator.rs +++ b/ecosystem/indexer-grpc/indexer-grpc-fullnode/src/stream_coordinator.rs @@ -366,7 +366,13 @@ impl IndexerStreamCoordinator { // Do not update block_height if first block is block metadata if ind > 0 { // Update the timestamp if the next block occurs - if let Some(txn) = raw_txn.transaction.try_as_block_metadata() { + if let Some(txn) = raw_txn.transaction.try_as_block_metadata_ext() { + timestamp = txn.timestamp_usecs(); + epoch = txn.epoch(); + epoch_bcs = aptos_api_types::U64::from(epoch); + block_height += 1; + block_height_bcs = aptos_api_types::U64::from(block_height); + } else if let Some(txn) = raw_txn.transaction.try_as_block_metadata() { timestamp = txn.timestamp_usecs(); epoch = txn.epoch(); epoch_bcs = aptos_api_types::U64::from(epoch); diff --git a/storage/aptosdb/src/fake_aptosdb.rs b/storage/aptosdb/src/fake_aptosdb.rs index fdc0609424d8f..3cd3ad65ad995 100644 --- a/storage/aptosdb/src/fake_aptosdb.rs +++ b/storage/aptosdb/src/fake_aptosdb.rs @@ -338,7 +338,10 @@ impl FakeAptosDB { .or_insert(user_txn.sequence_number()); } - if let Some(txn) = txn_to_commit.transaction().try_as_block_metadata() { + if let Some(txn) = txn_to_commit.transaction().try_as_block_metadata_ext() { + self.latest_block_timestamp + .fetch_max(txn.timestamp_usecs(), Ordering::Relaxed); + } else if let Some(txn) = txn_to_commit.transaction().try_as_block_metadata() { self.latest_block_timestamp .fetch_max(txn.timestamp_usecs(), Ordering::Relaxed); }