Commit fd4a3f83 authored by Éloïs's avatar Éloïs
Browse files

[feat] bca: add current ud

parent 5fe9ecf1
......@@ -14,6 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
mod balances;
mod current_ud;
mod last_blockstamp_out_of_fork_window;
mod members_count;
mod prepare_simple_payment;
......@@ -90,5 +91,6 @@ pub(super) async fn execute_req_type(
.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 {
Ping,
SendTxs(Txs),
Identities(ArrayVec<[PublicKey; 16]>),
CurrentUd,
}
// Request types helpers
......@@ -114,6 +115,7 @@ pub enum BcaRespTypeV0 {
Pong,
RejectedTxs(Vec<rejected_tx::RejectedTx>),
Identities(ArrayVec<[Option<Identity>; 16]>),
CurrentUd(SourceAmount),
}
// Result and error
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment