mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Stop validators from equivocating on reboot
Part of https://github.com/serai-dex/serai/issues/345. The lack of full DB persistence does mean enough nodes rebooting at the same time may cause a halt. This will prevent slashes.
This commit is contained in:
@@ -10,6 +10,8 @@ use parity_scale_codec::{Encode, Decode};
|
||||
use futures_util::sink::SinkExt;
|
||||
use tokio::{sync::RwLock, time::sleep};
|
||||
|
||||
use serai_db::MemDb;
|
||||
|
||||
use tendermint_machine::{
|
||||
ext::*, SignedMessageFor, SyncedBlockSender, SyncedBlockResultReceiver, MessageSender,
|
||||
SlashEvent, TendermintMachine, TendermintHandle,
|
||||
@@ -111,6 +113,8 @@ struct TestNetwork(
|
||||
|
||||
#[async_trait]
|
||||
impl Network for TestNetwork {
|
||||
type Db = MemDb;
|
||||
|
||||
type ValidatorId = TestValidatorId;
|
||||
type SignatureScheme = TestSignatureScheme;
|
||||
type Weights = TestWeights;
|
||||
@@ -170,6 +174,7 @@ impl TestNetwork {
|
||||
let i = u16::try_from(i).unwrap();
|
||||
let TendermintHandle { messages, synced_block, synced_block_result, machine } =
|
||||
TendermintMachine::new(
|
||||
MemDb::new(),
|
||||
TestNetwork(i, arc.clone()),
|
||||
BlockNumber(1),
|
||||
start_time,
|
||||
|
||||
Reference in New Issue
Block a user