Skip to content
Snippets Groups Projects
Commit 56dd9795 authored by Éloïs's avatar Éloïs
Browse files

fix(writer): write col currency_params

parent 3d73efff
No related branches found
No related tags found
No related merge requests found
Pipeline #12518 passed
......@@ -18,7 +18,7 @@ mod txs;
mod uds;
use crate::*;
use duniter_dbs::databases::bc_v2::BcV2DbWritable;
use duniter_dbs::{databases::bc_v2::BcV2DbWritable, CurrencyParamsDbV2};
pub fn apply_block<B: Backend>(
bc_db: &duniter_dbs::databases::bc_v2::BcV2Db<B>,
......@@ -36,6 +36,7 @@ pub fn apply_block<B: Backend>(
bc_db.uids_index_write(),
bc_db.utxos_write(),
bc_db.consumed_utxos_write(),
bc_db.currency_params_write(),
)
.write(
|(
......@@ -47,7 +48,17 @@ pub fn apply_block<B: Backend>(
mut uids_index,
mut utxos,
mut consumed_utxos,
mut currency_params,
)| {
if let Some(params) = block.currency_parameters() {
currency_params.upsert(
(),
CurrencyParamsDbV2 {
currency_name: block.currency_name(),
params,
},
);
}
blocks_meta.upsert(U32BE(block.number().0), block_meta);
identities::update_identities::<B>(&block, &mut identities)?;
for idty in block.identities() {
......@@ -106,6 +117,7 @@ pub fn revert_block<B: Backend>(
bc_db.uids_index_write(),
bc_db.utxos_write(),
bc_db.consumed_utxos_write(),
bc_db.currency_params_write(),
)
.write(
|(
......@@ -117,7 +129,11 @@ pub fn revert_block<B: Backend>(
mut uids_index,
mut utxos,
mut consumed_utxos,
mut currency_params,
)| {
if block.number() == BlockNumber(0) {
currency_params.remove(());
}
txs::revert_txs::<B>(
block.number(),
block.transactions(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment