mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Simply Coordinator/Processors::send by accepting impl Into *Message
This commit is contained in:
@@ -18,7 +18,7 @@ use serai_client::{
|
||||
|
||||
use serai_db::DbTxn;
|
||||
|
||||
use processor_messages::{SubstrateContext, CoordinatorMessage};
|
||||
use processor_messages::SubstrateContext;
|
||||
|
||||
use tokio::time::sleep;
|
||||
|
||||
@@ -102,21 +102,19 @@ async fn handle_key_gen<D: Db, Pro: Processors>(
|
||||
processors
|
||||
.send(
|
||||
set.network,
|
||||
CoordinatorMessage::Substrate(
|
||||
processor_messages::substrate::CoordinatorMessage::ConfirmKeyPair {
|
||||
context: SubstrateContext {
|
||||
serai_time: block.time().unwrap() / 1000,
|
||||
network_latest_finalized_block: serai
|
||||
.get_latest_block_for_network(block.hash(), set.network)
|
||||
.await?
|
||||
// The processor treats this as a magic value which will cause it to find a network
|
||||
// block which has a time greater than or equal to the Serai time
|
||||
.unwrap_or(BlockHash([0; 32])),
|
||||
},
|
||||
set,
|
||||
key_pair,
|
||||
processor_messages::substrate::CoordinatorMessage::ConfirmKeyPair {
|
||||
context: SubstrateContext {
|
||||
serai_time: block.time().unwrap() / 1000,
|
||||
network_latest_finalized_block: serai
|
||||
.get_latest_block_for_network(block.hash(), set.network)
|
||||
.await?
|
||||
// The processor treats this as a magic value which will cause it to find a network
|
||||
// block which has a time greater than or equal to the Serai time
|
||||
.unwrap_or(BlockHash([0; 32])),
|
||||
},
|
||||
),
|
||||
set,
|
||||
key_pair,
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -197,18 +195,16 @@ async fn handle_batch_and_burns<D: Db, Pro: Processors>(
|
||||
processors
|
||||
.send(
|
||||
network,
|
||||
CoordinatorMessage::Substrate(
|
||||
processor_messages::substrate::CoordinatorMessage::SubstrateBlock {
|
||||
context: SubstrateContext {
|
||||
serai_time: block.time().unwrap() / 1000,
|
||||
network_latest_finalized_block,
|
||||
},
|
||||
network,
|
||||
block: block.number(),
|
||||
burns: burns.remove(&network).unwrap(),
|
||||
batches: batches.remove(&network).unwrap(),
|
||||
processor_messages::substrate::CoordinatorMessage::SubstrateBlock {
|
||||
context: SubstrateContext {
|
||||
serai_time: block.time().unwrap() / 1000,
|
||||
network_latest_finalized_block,
|
||||
},
|
||||
),
|
||||
network,
|
||||
block: block.number(),
|
||||
burns: burns.remove(&network).unwrap(),
|
||||
batches: batches.remove(&network).unwrap(),
|
||||
},
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user