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(mirror): queue fake blocks for initial create account txs #11336

Merged
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
17 changes: 12 additions & 5 deletions tools/mirror/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1815,17 +1815,24 @@ impl<T: ChainAccess> TxMirror<T> {
// send any extra function call-initiated create accounts for the first few blocks right now
// we set source_hash to 0 because we don't actually care about it here, and it doesn't even exist since these are
// not transactions corresponding to some actual block, but just extra txs create account actions in the first few blocks.
let mut txs = Vec::new();
let mut block = MappedBlock {
source_hash: CryptoHash::default(),
source_height: last_height,
chunks: vec![MappedChunk { shard_id: 0, txs: Vec::new() }],
};
for h in next_heights {
self.add_create_account_txs(h, target_head, &mut tracker, &mut txs).await?;
self.add_create_account_txs(h, target_head, &mut tracker, &mut block.chunks[0].txs)
.await?;
}
if !txs.is_empty() {
if block.chunks.iter().any(|c| !c.txs.is_empty()) {
tracing::debug!(target: "mirror", "sending extra create account transactions for the first {} blocks", CREATE_ACCOUNT_DELTA);
self.send_transactions(txs.iter_mut()).await?;
tracker.queue_block(block, &self.target_view_client, &self.db).await?;
let mut b = tracker.next_batch(&self.target_view_client, &self.db).await?;
self.send_transactions(b.txs.iter_mut().map(|(_tx_ref, tx)| tx)).await?;
tracker
.on_txs_sent(
&self.db,
crate::chain_tracker::SentBatch::ExtraTxs(txs),
crate::chain_tracker::SentBatch::MappedBlock(b),
target_height,
)
.await?;
Expand Down
Loading