mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Remove final references to scale in coordinator/processor
Slight tweaks to processor
This commit is contained in:
@@ -34,7 +34,7 @@ static SEND_LOCK: LazyLock<Mutex<()>> = LazyLock::new(|| Mutex::new(()));
|
||||
|
||||
db_channel! {
|
||||
ProcessorBinCoordinator {
|
||||
SentCoordinatorMessages: () -> Vec<u8>,
|
||||
SentCoordinatorMessages: () -> messages::ProcessorMessage,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ impl CoordinatorSend {
|
||||
fn send(&mut self, msg: &messages::ProcessorMessage) {
|
||||
let _lock = SEND_LOCK.lock().unwrap();
|
||||
let mut txn = self.db.txn();
|
||||
SentCoordinatorMessages::send(&mut txn, &borsh::to_vec(msg).unwrap());
|
||||
SentCoordinatorMessages::send(&mut txn, msg);
|
||||
txn.commit();
|
||||
self
|
||||
.sent_message
|
||||
@@ -114,12 +114,9 @@ impl Coordinator {
|
||||
let mut txn = db.txn();
|
||||
match SentCoordinatorMessages::try_recv(&mut txn) {
|
||||
Some(msg) => {
|
||||
let metadata = Metadata {
|
||||
from: service,
|
||||
to: Service::Coordinator,
|
||||
intent: borsh::from_slice::<messages::ProcessorMessage>(&msg).unwrap().intent(),
|
||||
};
|
||||
message_queue.queue_with_retry(metadata, msg).await;
|
||||
let metadata =
|
||||
Metadata { from: service, to: Service::Coordinator, intent: msg.intent() };
|
||||
message_queue.queue_with_retry(metadata, borsh::to_vec(&msg).unwrap()).await;
|
||||
txn.commit();
|
||||
}
|
||||
None => {
|
||||
|
||||
@@ -7,7 +7,6 @@ use serai_primitives::{
|
||||
balance::{Amount, ExternalBalance},
|
||||
};
|
||||
|
||||
use borsh::BorshDeserialize;
|
||||
use serai_db::{Get, DbTxn, create_db, db_channel};
|
||||
|
||||
use primitives::{Payment, ReceivedOutput};
|
||||
@@ -22,9 +21,10 @@ create_db! {
|
||||
}
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
db_channel! {
|
||||
UtxoScheduler {
|
||||
PendingBranch: (key: &[u8], balance: ExternalBalance) -> Vec<u8>,
|
||||
PendingBranch: <S: ScannerFeed>(key: &[u8], balance: ExternalBalance) -> TreeTransaction<AddressFor<S>>,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,14 +103,13 @@ impl<S: ScannerFeed> Db<S> {
|
||||
balance: ExternalBalance,
|
||||
child: &TreeTransaction<AddressFor<S>>,
|
||||
) {
|
||||
PendingBranch::send(txn, key.to_bytes().as_ref(), balance, &borsh::to_vec(child).unwrap())
|
||||
PendingBranch::<S>::send(txn, key.to_bytes().as_ref(), balance, child)
|
||||
}
|
||||
pub(crate) fn take_pending_branch(
|
||||
txn: &mut impl DbTxn,
|
||||
key: KeyFor<S>,
|
||||
balance: ExternalBalance,
|
||||
) -> Option<TreeTransaction<AddressFor<S>>> {
|
||||
PendingBranch::try_recv(txn, key.to_bytes().as_ref(), balance)
|
||||
.map(|bytes| TreeTransaction::<AddressFor<S>>::deserialize(&mut bytes.as_slice()).unwrap())
|
||||
PendingBranch::<S>::try_recv(txn, key.to_bytes().as_ref(), balance)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,10 +123,7 @@ impl<D: Db> ContinuallyRan for CosignerTask<D> {
|
||||
|
||||
let cosign = self.current_cosign.take().unwrap();
|
||||
LatestCosigned::set(&mut txn, self.session, &cosign.block_number);
|
||||
let cosign = SignedCosign {
|
||||
cosign,
|
||||
signature: borsh::to_vec(&Signature::from(signature)).unwrap().try_into().unwrap(),
|
||||
};
|
||||
let cosign = SignedCosign { cosign, signature: Signature::from(signature).0 };
|
||||
// Send the cosign
|
||||
Cosign::send(&mut txn, self.session, &cosign);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user