mirror of
https://github.com/serai-dex/serai.git
synced 2024-11-16 17:07:35 +00:00
Correct publication of Completed Tributary TXs
This commit is contained in:
parent
fddc605c65
commit
cd4c3a6c88
3 changed files with 13 additions and 2 deletions
|
@ -748,6 +748,13 @@ pub async fn handle_processors<D: Db, Pro: Processors, P: P2p>(
|
|||
panic!("provided an invalid transaction: {res:?}");
|
||||
}
|
||||
}
|
||||
TransactionKind::Unsigned => {
|
||||
log::trace!("publishing unsigned transaction {}", hex::encode(tx.hash()));
|
||||
// Ignores the result since we can't differentiate already in-mempool from already
|
||||
// on-chain from invalid
|
||||
// TODO: Don't ignore the result
|
||||
tributary.add_transaction(tx).await;
|
||||
}
|
||||
TransactionKind::Signed(_) => {
|
||||
// Get the next nonce
|
||||
// TODO: This should be deterministic, not just DB-backed, to allow rebuilding validators
|
||||
|
@ -767,7 +774,6 @@ pub async fn handle_processors<D: Db, Pro: Processors, P: P2p>(
|
|||
|
||||
// txn.commit();
|
||||
}
|
||||
_ => panic!("created an unexpected transaction"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -550,6 +550,11 @@ pub async fn handle_application_tx<
|
|||
}
|
||||
}
|
||||
Transaction::SignCompleted { plan, tx_hash, .. } => {
|
||||
log::info!(
|
||||
"on-chain SignCompleted claims {} completes {}",
|
||||
hex::encode(&tx_hash),
|
||||
hex::encode(plan)
|
||||
);
|
||||
// TODO: Confirm this is a valid plan ID
|
||||
// TODO: Confirm this signer hasn't prior published a completion
|
||||
let Some(key_pair) = TributaryDb::<D>::key_pair(txn, spec.set()) else { todo!() };
|
||||
|
|
|
@ -221,7 +221,7 @@ impl<D: Db, T: TransactionTrait, P: P2p> Tributary<D, T, P> {
|
|||
self.network.blockchain.read().await.next_nonce(signer)
|
||||
}
|
||||
|
||||
// Returns if the transaction was valid.
|
||||
// Returns if the transaction was new and valid.
|
||||
// Safe to be &self since the only meaningful usage of self is self.network.blockchain which
|
||||
// successfully acquires its own write lock
|
||||
pub async fn add_transaction(&self, tx: T) -> bool {
|
||||
|
|
Loading…
Reference in a new issue