mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Add Batch messages from processor, verify Batchs published on-chain
Renames Update to SignedBatch. Checks Batch equality via a hash of the InInstructions. That prevents needing to keep the Batch in node state or TX introspect.
This commit is contained in:
@@ -530,6 +530,12 @@ async fn run<N: Network, D: Db, Co: Coordinator>(mut raw_db: D, network: N, mut
|
||||
for batch in batches {
|
||||
info!("created batch {} ({} instructions)", batch.id, batch.instructions.len());
|
||||
|
||||
coordinator.send(
|
||||
messages::ProcessorMessage::Substrate(
|
||||
messages::substrate::ProcessorMessage::Batch { batch: batch.clone() }
|
||||
)
|
||||
).await;
|
||||
|
||||
if let Some(substrate_signer) = tributary_mutable.substrate_signer.as_mut() {
|
||||
substrate_signer.sign(txn, batch).await;
|
||||
}
|
||||
@@ -588,9 +594,9 @@ async fn run<N: Network, D: Db, Co: Coordinator>(mut raw_db: D, network: N, mut
|
||||
}
|
||||
SubstrateSignerEvent::SignedBatch(batch) => {
|
||||
coordinator
|
||||
.send(ProcessorMessage::Substrate(messages::substrate::ProcessorMessage::Update {
|
||||
batch,
|
||||
}))
|
||||
.send(ProcessorMessage::Substrate(
|
||||
messages::substrate::ProcessorMessage::SignedBatch { batch },
|
||||
))
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user