mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Further work on transaction signing
This commit is contained in:
@@ -520,3 +520,26 @@ impl SubstrateToEventualityDb {
|
||||
Burns::try_recv(txn, acknowledged_block)
|
||||
}
|
||||
}
|
||||
|
||||
mod _completed_eventualities {
|
||||
use serai_db::{Get, DbTxn, create_db, db_channel};
|
||||
|
||||
db_channel! {
|
||||
ScannerPublic {
|
||||
CompletedEventualities: (empty_key: ()) -> [u8; 32],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The IDs of completed Eventualities found on-chain, within a finalized block.
|
||||
pub struct CompletedEventualities<S: ScannerFeed>(PhantomData<S>);
|
||||
impl<S: ScannerFeed> CompletedEventualities<S> {
|
||||
pub(crate) fn send(txn: &mut impl DbTxn, id: [u8; 32]) {
|
||||
_completed_eventualities::CompletedEventualities::send(txn, (), &id);
|
||||
}
|
||||
|
||||
/// Receive the ID of a completed Eventuality.
|
||||
pub fn try_recv(txn: &mut impl DbTxn) -> Option<[u8; 32]> {
|
||||
_completed_eventualities::CompletedEventualities::try_recv(txn, ())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::{
|
||||
ScanToEventualityDb,
|
||||
},
|
||||
BlockExt, ScannerFeed, KeyFor, AddressFor, OutputFor, EventualityFor, SchedulerUpdate, Scheduler,
|
||||
sort_outputs,
|
||||
CompletedEventualities, sort_outputs,
|
||||
scan::{next_to_scan_for_outputs_block, queue_output_until_block},
|
||||
};
|
||||
|
||||
@@ -292,8 +292,13 @@ impl<D: Db, S: ScannerFeed, Sch: Scheduler<S>> ContinuallyRan for EventualityTas
|
||||
completed_eventualities
|
||||
};
|
||||
|
||||
for tx in completed_eventualities.keys() {
|
||||
log::info!("eventuality resolved by {}", hex::encode(tx.as_ref()));
|
||||
for (tx, eventuality) in &completed_eventualities {
|
||||
log::info!(
|
||||
"eventuality {} resolved by {}",
|
||||
hex::encode(eventuality.id()),
|
||||
hex::encode(tx.as_ref())
|
||||
);
|
||||
CompletedEventualities::<S>::send(&mut txn, eventuality.id());
|
||||
}
|
||||
|
||||
// Fetch all non-External outputs
|
||||
|
||||
@@ -21,6 +21,7 @@ pub use lifetime::LifetimeStage;
|
||||
|
||||
// Database schema definition and associated functions.
|
||||
mod db;
|
||||
pub use db::CompletedEventualities;
|
||||
// Task to index the blockchain, ensuring we don't reorganize finalized blocks.
|
||||
mod index;
|
||||
// Scans blocks for received coins.
|
||||
@@ -170,6 +171,10 @@ pub type EventualityFor<S> = <<S as ScannerFeed>::Block as Block>::Eventuality;
|
||||
/// The block type for this ScannerFeed.
|
||||
pub type BlockFor<S> = <S as ScannerFeed>::Block;
|
||||
|
||||
/// An object usable to publish a Batch.
|
||||
// This will presumably be the Batch signer defined in `serai-processor-signers` or a test shim.
|
||||
// It could also be some app-layer database for the purpose of verifying the Batches published to
|
||||
// Serai.
|
||||
#[async_trait::async_trait]
|
||||
pub trait BatchPublisher: 'static + Send + Sync {
|
||||
/// An error encountered when publishing the Batch.
|
||||
|
||||
Reference in New Issue
Block a user