mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Use &self for handle_message and sync_block in Tributary
They used &mut self to prevent execution at the same time. This uses a lock
over the channel to achieve the same security, without requiring a lock over
the entire tributary.
This fixes post-provided Provided transactions. sync_block waited for the TX to
be provided, yet it never would as sync_block held a mutable reference over the
entire Tributary, preventing any other read/write operations of any scope.
A timeout increased (bc2f23f72b) due to this bug
not being identified has been decreased back, thankfully.
Also shims in basic support for Completed, which was the WIP before this bug
was identified.
This commit is contained in:
@@ -589,8 +589,20 @@ pub async fn handle_application_tx<
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
Transaction::SignCompleted(_, _, _) => {
|
||||
// TODO
|
||||
Transaction::SignCompleted(id, tx, signed) => {
|
||||
// TODO: Confirm this is a valid ID
|
||||
// TODO: Confirm this signer hasn't prior published a completion
|
||||
let Some(key_pair) = TributaryDb::<D>::key_pair(txn, spec.set()) else { todo!() };
|
||||
processors
|
||||
.send(
|
||||
spec.set().network,
|
||||
CoordinatorMessage::Sign(sign::CoordinatorMessage::Completed {
|
||||
key: key_pair.1.to_vec(),
|
||||
id,
|
||||
tx,
|
||||
}),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user