Feature/slate version ()

* Add a slate version field
* Move current slate version to constant
* Change slate version to uint
* Add default 0 incase it's missing (pre-versioning)
This commit is contained in:
Ignotus Peverell 2019-02-01 11:17:54 -08:00 committed by GitHub
commit c41ea4bcf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,6 +31,8 @@ use rand::thread_rng;
use std::sync::Arc;
use uuid::Uuid;
const CURRENT_SLATE_VERSION: u64 = 1;
/// Public data for each participant in the slate
#[derive(Serialize, Deserialize, Debug, Clone)]
@ -119,6 +121,13 @@ pub struct Slate {
/// insert their public data here. For now, 0 is sender and 1
/// is receiver, though this will change for multi-party
pub participant_data: Vec<ParticipantData>,
/// Slate format version
#[serde(default = "no_version")]
pub version: u64,
}
fn no_version() -> u64 {
0
}
/// Helper just to facilitate serialization
@ -140,6 +149,7 @@ impl Slate {
height: 0,
lock_height: 0,
participant_data: vec![],
version: CURRENT_SLATE_VERSION,
}
}