diff --git a/benches/nats-publisher/src/main.rs b/benches/nats-publisher/src/main.rs index 496e6de2..62050a44 100644 --- a/benches/nats-publisher/src/main.rs +++ b/benches/nats-publisher/src/main.rs @@ -47,7 +47,8 @@ async fn main() -> anyhow::Result<()> { for height in 0..*last_height { let height = height.into(); let block = block_helper.find_by_height(height); - let block = Block::new(&block, Consensus::default()); + let block = + Block::new(&block, Consensus::default(), Vec::new()); block_helper.publish(&block).await?; // for (index, tx) in block.transactions().iter().enumerate() { @@ -65,7 +66,7 @@ async fn main() -> anyhow::Result<()> { while let Ok(result) = subscription.recv().await { let result = &**result; let block = &result.sealed_block.entity; - let block = Block::new(block, Consensus::default()); + let block = Block::new(block, Consensus::default(), Vec::new()); block_helper.publish(&block).await?; // for (index, tx) in block.transactions().iter().enumerate() { diff --git a/crates/fuel-streams-core/src/blocks/mod.rs b/crates/fuel-streams-core/src/blocks/mod.rs index cd5636d4..befdb552 100644 --- a/crates/fuel-streams-core/src/blocks/mod.rs +++ b/crates/fuel-streams-core/src/blocks/mod.rs @@ -42,7 +42,7 @@ mod tests { header: header.clone(), height: 42, id: Default::default(), - transactions: vec![], // Always empty for now + transaction_ids: vec![], version: BlockVersion::V1, }; @@ -76,7 +76,7 @@ mod tests { }, "height": 42, "id": "0000000000000000000000000000000000000000000000000000000000000000", - "transactions": [], + "transactionIds": [], "version": "V1" }); diff --git a/crates/fuel-streams-core/src/blocks/types.rs b/crates/fuel-streams-core/src/blocks/types.rs index 1d5ccbad..26b201a5 100644 --- a/crates/fuel-streams-core/src/blocks/types.rs +++ b/crates/fuel-streams-core/src/blocks/types.rs @@ -8,7 +8,7 @@ pub struct Block { pub header: BlockHeader, pub height: u32, pub id: FuelCoreBlockId, - pub transactions: Vec, + pub transaction_ids: Vec, pub version: BlockVersion, } @@ -16,6 +16,7 @@ impl Block { pub fn new( block: &fuel_core_types::blockchain::block::Block, consensus: Consensus, + transaction_ids: Vec, ) -> Self { let header: BlockHeader = block.header().into(); let height = header.height; @@ -32,7 +33,7 @@ impl Block { header, height, id, - transactions: Vec::new(), + transaction_ids, version, } } @@ -187,6 +188,6 @@ impl MockBlock { .collect::>(); *block.transactions_mut() = txs; - Block::new(&block, Consensus::default()) + Block::new(&block, Consensus::default(), Vec::new()) } } diff --git a/crates/fuel-streams-publisher/src/publisher/mod.rs b/crates/fuel-streams-publisher/src/publisher/mod.rs index df40b810..4e180989 100644 --- a/crates/fuel-streams-publisher/src/publisher/mod.rs +++ b/crates/fuel-streams-publisher/src/publisher/mod.rs @@ -212,6 +212,11 @@ impl Publisher { let block_producer = Arc::new(block_producer.clone()); let block_height = block.header().consensus().height; let txs = block.transactions(); + let transaction_ids = txs + .iter() + .map(|tx| tx.id(&chain_id).into()) + .collect::>(); + let consensus: Consensus = self.fuel_core.get_consensus(&block_height)?.into(); @@ -239,6 +244,7 @@ impl Publisher { block, block_stream, opts, + transaction_ids, ))) .collect::>(); diff --git a/crates/fuel-streams-publisher/src/publisher/payloads/blocks.rs b/crates/fuel-streams-publisher/src/publisher/payloads/blocks.rs index 96e1a680..947fb7df 100644 --- a/crates/fuel-streams-publisher/src/publisher/payloads/blocks.rs +++ b/crates/fuel-streams-publisher/src/publisher/payloads/blocks.rs @@ -9,12 +9,13 @@ pub fn publish_task( block: &FuelCoreBlock, stream: Arc>, opts: &Arc, + transaction_ids: Vec, ) -> JoinHandle> { let block_height = (*opts.block_height).clone(); let block_producer = (*opts.block_producer).clone(); let consensus = (*opts.consensus).clone(); - let block = Block::new(block, consensus); + let block = Block::new(block, consensus, transaction_ids); let packet = PublishPacket::new( block, BlocksSubject {