mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Start defining the coordinator
This commit is contained in:
@@ -2,7 +2,7 @@ use core::time::Duration;
|
||||
|
||||
use tokio::time::sleep;
|
||||
|
||||
use serai_client::subxt::{config::Header, utils::Encoded};
|
||||
use serai_client::subxt::utils::Encoded;
|
||||
|
||||
use crate::common::serai;
|
||||
|
||||
@@ -10,13 +10,8 @@ use crate::common::serai;
|
||||
pub async fn publish_tx(tx: &Encoded) -> [u8; 32] {
|
||||
let serai = serai().await;
|
||||
|
||||
let mut latest = serai
|
||||
.get_block(serai.get_latest_block_hash().await.unwrap())
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.header
|
||||
.number();
|
||||
let mut latest =
|
||||
serai.get_block(serai.get_latest_block_hash().await.unwrap()).await.unwrap().unwrap().number();
|
||||
|
||||
serai.publish(tx).await.unwrap();
|
||||
|
||||
@@ -42,9 +37,9 @@ pub async fn publish_tx(tx: &Encoded) -> [u8; 32] {
|
||||
block.unwrap()
|
||||
};
|
||||
|
||||
for extrinsic in block.extrinsics {
|
||||
if extrinsic.0 == tx.0[2 ..] {
|
||||
return block.header.hash().into();
|
||||
for transaction in block.transactions() {
|
||||
if transaction.0 == tx.0[2 ..] {
|
||||
return block.hash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ use serai_client::{
|
||||
primitives::{Session, ValidatorSet},
|
||||
ValidatorSetsEvent,
|
||||
},
|
||||
subxt::config::Header,
|
||||
Serai,
|
||||
};
|
||||
|
||||
@@ -38,9 +37,7 @@ serai_test!(
|
||||
// Make sure the genesis is as expected
|
||||
assert_eq!(
|
||||
serai
|
||||
.get_new_set_events(
|
||||
serai.get_block_by_number(0).await.unwrap().unwrap().header.hash().into()
|
||||
)
|
||||
.get_new_set_events(serai.get_block_by_number(0).await.unwrap().unwrap().hash())
|
||||
.await
|
||||
.unwrap(),
|
||||
[BITCOIN_NET_ID, ETHEREUM_NET_ID, MONERO_NET_ID]
|
||||
|
||||
Reference in New Issue
Block a user