mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Code a method to determine the activation block before any block has consensus
[0; 32] is a magic for no block has been set yet due to this being the first key pair. If [0; 32] is the latest finalized block, the processor determines an activation block based on timestamps. This doesn't use an Option for ergonomic reasons.
This commit is contained in:
@@ -119,10 +119,13 @@ async fn handle_key_gen<D: Db, Pro: Processor>(
|
||||
.send(CoordinatorMessage::Substrate(
|
||||
processor_messages::substrate::CoordinatorMessage::ConfirmKeyPair {
|
||||
context: SubstrateContext {
|
||||
serai_time: block.time().unwrap(),
|
||||
coin_latest_finalized_block: serai
|
||||
.get_latest_block_for_network(block.hash(), set.network)
|
||||
.await?
|
||||
.unwrap_or(BlockHash([0; 32])), // TODO: Have the processor override this
|
||||
// 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,
|
||||
@@ -206,7 +209,10 @@ async fn handle_batch_and_burns<D: Db, Pro: Processor>(
|
||||
processor
|
||||
.send(CoordinatorMessage::Substrate(
|
||||
processor_messages::substrate::CoordinatorMessage::SubstrateBlock {
|
||||
context: SubstrateContext { coin_latest_finalized_block },
|
||||
context: SubstrateContext {
|
||||
serai_time: block.time().unwrap(),
|
||||
coin_latest_finalized_block,
|
||||
},
|
||||
key: get_coin_key(
|
||||
serai,
|
||||
// TODO2
|
||||
|
||||
Reference in New Issue
Block a user