Prepare for multiple nonce account state versions (#8612)

automerge
This commit is contained in:
Trent Nelson 2020-03-03 22:19:09 -07:00 committed by GitHub
parent b68b74ac32
commit b83a0434a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 17 deletions

View File

@ -1,3 +1,4 @@
use super::Versions;
use crate::{hash::Hash, pubkey::Pubkey};
use serde_derive::{Deserialize, Serialize};
@ -33,23 +34,6 @@ impl State {
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
pub enum Versions {
Current(Box<State>),
}
impl Versions {
pub fn new_current(state: State) -> Self {
Self::Current(Box::new(state))
}
pub fn convert_to_current(self) -> State {
match self {
Self::Current(state) => *state,
}
}
}
#[cfg(test)]
mod test {
use super::*;

View File

@ -0,0 +1,21 @@
mod current;
pub use current::{Meta, State};
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
pub enum Versions {
Current(Box<State>),
}
impl Versions {
pub fn new_current(state: State) -> Self {
Self::Current(Box::new(state))
}
pub fn convert_to_current(self) -> State {
match self {
Self::Current(state) => *state,
}
}
}