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

[feat] bca: add current ud

parent 5fe9ecf1
No related branches found
No related tags found
1 merge request!1369[feat] bca: add current ud
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
mod balances; mod balances;
mod current_ud;
mod last_blockstamp_out_of_fork_window; mod last_blockstamp_out_of_fork_window;
mod members_count; mod members_count;
mod prepare_simple_payment; mod prepare_simple_payment;
...@@ -90,5 +91,6 @@ pub(super) async fn execute_req_type( ...@@ -90,5 +91,6 @@ pub(super) async fn execute_req_type(
.await??, .await??,
)) ))
} }
BcaReqTypeV0::CurrentUd => current_ud::exec_req_current_ud(bca_executor).await,
} }
} }
// Copyright (C) 2020 Éloïs SANCHEZ.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::*;
pub(super) async fn exec_req_current_ud(
bca_executor: &BcaExecutor,
) -> Result<BcaRespTypeV0, ExecReqTypeError> {
if let Some(current_ud) = bca_executor
.cm_accessor
.get_current_meta(|cm| cm.current_ud)
.await
{
Ok(BcaRespTypeV0::CurrentUd(current_ud))
} else {
Err("no blockchain".into())
}
}
...@@ -77,6 +77,7 @@ pub enum BcaReqTypeV0 { ...@@ -77,6 +77,7 @@ pub enum BcaReqTypeV0 {
Ping, Ping,
SendTxs(Txs), SendTxs(Txs),
Identities(ArrayVec<[PublicKey; 16]>), Identities(ArrayVec<[PublicKey; 16]>),
CurrentUd,
} }
// Request types helpers // Request types helpers
...@@ -114,6 +115,7 @@ pub enum BcaRespTypeV0 { ...@@ -114,6 +115,7 @@ pub enum BcaRespTypeV0 {
Pong, Pong,
RejectedTxs(Vec<rejected_tx::RejectedTx>), RejectedTxs(Vec<rejected_tx::RejectedTx>),
Identities(ArrayVec<[Option<Identity>; 16]>), Identities(ArrayVec<[Option<Identity>; 16]>),
CurrentUd(SourceAmount),
} }
// Result and error // Result and error
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment