Convert tributary to use create_db macro (#448)

* chore: convert tributary to use create_db macro

* chore: fix fmt

* chore: break long line
This commit is contained in:
David Bell
2023-11-22 13:17:51 +04:00
committed by GitHub
parent 9ab2a2cfe0
commit 9df8c9476e
6 changed files with 142 additions and 294 deletions

View File

@@ -38,7 +38,7 @@ use ::tributary::{
mod tributary;
use crate::tributary::{
TributarySpec, SignData, Transaction, TributaryDb, NonceDecider, scanner::RecognizedIdType,
TributarySpec, SignData, Transaction, NonceDecider, scanner::RecognizedIdType, PlanIds,
};
mod db;
@@ -256,7 +256,7 @@ async fn handle_processor_message<D: Db, P: P2p>(
.iter()
.filter_map(|plan| Some(plan.id).filter(|_| plan.key == key))
.collect::<Vec<_>>();
TributaryDb::<D>::set_plan_ids(&mut txn, tributary.spec.genesis(), *block, &plans);
PlanIds::set(&mut txn, &tributary.spec.genesis(), *block, &plans);
let tx = Transaction::SubstrateBlock(*block);
log::trace!(
@@ -472,7 +472,7 @@ async fn handle_processor_message<D: Db, P: P2p>(
// As for the safety of calling error_generating_key_pair, the processor is presumed
// to only send InvalidShare or GeneratedKeyPair for a given attempt
let mut txs = if let Some(faulty) =
crate::tributary::error_generating_key_pair::<D, _>(&txn, key, spec, id.attempt)
crate::tributary::error_generating_key_pair::<_>(&txn, key, spec, id.attempt)
{
vec![Transaction::RemoveParticipant(faulty)]
} else {