Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
[consensus] also expose which account ids have been locked so far
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2bd committed Nov 16, 2021
1 parent d4fa4ce commit 36dc6e5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions fastpay_core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ impl Authority for AuthorityState {
.get_mut(&instance_id)
.ok_or(FastPayError::UnknownConsensusInstance(instance_id))?;
let info = ConsensusInfoResponse {
locked_accounts: instance.locked_accounts.clone(),
proposed: instance.proposed.clone(),
locked: instance.locked.clone(),
received: instance.received.clone(),
Expand Down
3 changes: 2 additions & 1 deletion fastpay_core/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::{base_types::*, committee::Committee, error::FastPayError};
mod messages_tests;

use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use std::collections::{BTreeMap, HashSet};

/// A message sent from the smart contract on the primary chain.
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
Expand Down Expand Up @@ -208,6 +208,7 @@ pub enum ConsensusOrder {
#[derive(Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct ConsensusInfoResponse {
pub locked_accounts: BTreeMap<AccountId, AccountOwner>,
pub proposed: Option<ConsensusProposal>,
pub locked: Option<Certificate>,
pub received: Certificate,
Expand Down
6 changes: 6 additions & 0 deletions fastpay_core/tests/staged/fastpay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ ConsensusDecision:
Confirm: UNIT
ConsensusInfoResponse:
STRUCT:
- locked_accounts:
MAP:
KEY:
TYPENAME: AccountId
VALUE:
TYPENAME: PublicKeyBytes
- proposed:
OPTION:
TYPENAME: ConsensusProposal
Expand Down

0 comments on commit 36dc6e5

Please sign in to comment.