Satisfy Scheduler for Bitcoin

This commit is contained in:
Luke Parker
2024-09-11 00:01:40 -04:00
parent ba3a6f9e91
commit 017aab2258
13 changed files with 245 additions and 357 deletions

View File

@@ -17,8 +17,6 @@ rustdoc-args = ["--cfg", "docsrs"]
workspace = true
[dependencies]
async-trait = { version = "0.1", default-features = false }
borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] }
serai-primitives = { path = "../../../../substrate/primitives", default-features = false, features = ["std"] }

View File

@@ -39,7 +39,6 @@ pub struct AmortizePlannedTransaction<S: ScannerFeed, ST: SignableTransaction, A
}
/// An object able to plan a transaction.
#[async_trait::async_trait]
pub trait TransactionPlanner<S: ScannerFeed, A>: 'static + Send + Sync {
/// The type representing a fee rate to use for transactions.
type FeeRate: Clone + Copy;

View File

@@ -203,6 +203,9 @@ impl<S: ScannerFeed, P: TransactionPlanner<S, ()>> Scheduler<S, P> {
// Fetch the operating costs/outputs
let mut operating_costs = Db::<S>::operating_costs(txn, coin).0;
let outputs = Db::<S>::outputs(txn, key, coin).unwrap();
if outputs.is_empty() {
continue;
}
// Fetch the fulfillable payments
let payments = Self::fulfillable_payments(

View File

@@ -23,7 +23,7 @@ mod db;
use db::Db;
/// The outputs which will be effected by a PlannedTransaction and received by Serai.
pub struct EffectedReceivedOutputs<S: ScannerFeed>(Vec<OutputFor<S>>);
pub struct EffectedReceivedOutputs<S: ScannerFeed>(pub Vec<OutputFor<S>>);
/// A scheduler of transactions for networks premised on the UTXO model which support
/// transaction chaining.
@@ -179,6 +179,9 @@ impl<S: ScannerFeed, P: TransactionPlanner<S, EffectedReceivedOutputs<S>>> Sched
// Fetch the operating costs/outputs
let mut operating_costs = Db::<S>::operating_costs(txn, coin).0;
let outputs = Db::<S>::outputs(txn, key, coin).unwrap();
if outputs.is_empty() {
continue;
}
// Fetch the fulfillable payments
let payments = Self::fulfillable_payments(