Commit e8c1b646 authored by jawaka's avatar jawaka

wip: tests

parent 97894794
Pipeline #6120 waiting for manual action with stage
......@@ -136,6 +136,8 @@ pub fn gen_mock_currency_parameters() -> CurrencyParameters {
}
}
use dup_crypto::bases::b16::str_hex_to_32bytes;
/// Generate mock block which is not a genesis block
pub fn gen_mock_normal_block_v10() -> BlockDocumentV10 {
let cert1 = CertificationDocumentParser::parse("Version: 10
......@@ -183,7 +185,7 @@ Comment: DU symbolique pour demander le codage de nouvelles fonctionnalites cf.
a9PHPuSfw7jW8FRQHXFsGi/bnLjbtDnTYvEVgUC9u0WlR7GVofa+Xb+l5iy6NwuEXiwvueAkf08wPVY8xrNcCg==").expect("Fail to parse tx2");
BlockDocumentV10 {
nonce: 0,
nonce: 10_300_000_018_323,
version: 10,
number: BlockNumber(107_984),
pow_min: 88,
......@@ -202,7 +204,10 @@ a9PHPuSfw7jW8FRQHXFsGi/bnLjbtDnTYvEVgUC9u0WlR7GVofa+Xb+l5iy6NwuEXiwvueAkf08wPVY8
parameters: None,
previous_hash: Some(Hash::from_hex("000001144968D0C3516BE6225E4662F182E28956AF46DD7FB228E3D0F9413FEB").expect("fail to parse previous_hash")),
previous_issuer: Some(PubKey::Ed25519(ed25519::PublicKey::from_base58("D3krfq6J9AmfpKnS3gQVYoy7NzGCc61vokteTS8LJ4YH").unwrap())),
inner_hash: None,
inner_hash: Some(Hash(
str_hex_to_32bytes(
"C8AB69E33ECE2612EADC7AB30D069B1F1A3D8C95EBBFD50DE583AC8E3666CCA1",
).unwrap() )),
dividend: None,
identities: Vec::new(),
joiners: Vec::new(),
......@@ -214,3 +219,40 @@ a9PHPuSfw7jW8FRQHXFsGi/bnLjbtDnTYvEVgUC9u0WlR7GVofa+Xb+l5iy6NwuEXiwvueAkf08wPVY8
transactions: vec![TxDocOrTxHash::TxDoc(Box::new(tx1)), TxDocOrTxHash::TxDoc(Box::new(tx2))],
}
}
/// Generate a mock genesis block
pub fn gen_mock_genesis_block_v10() -> BlockDocumentV10 {
use dup_currency_params::genesis_block_params::v10::BlockV10Parameters;
BlockDocumentV10 {
nonce: 0,
version: 10,
number: BlockNumber(0),
pow_min: 0,
time: 0,
median_time: 0,
members_count: 0,
monetary_mass: 0,
unit_base: 0,
issuers_count: 0,
issuers_frame: 0,
issuers_frame_var: 0,
currency: CurrencyName(String::from("g1")),
issuers: vec![PubKey::Ed25519(ed25519::PublicKey::from_base58("DA4PYtXdvQqk1nCaprXH52iMsK5Ahxs1nRWbWKLhpVkQ").unwrap())],
signatures: vec![Sig::Ed25519(ed25519::Signature::from_base64("92id58VmkhgVNee4LDqBGSm8u/ooHzAD67JM6fhAE/CV8LCz7XrMF1DvRl+eRpmlaVkp6I+Iy8gmZ1WUM5C8BA==").unwrap())],
hash: None,
parameters: Some(BlockV10Parameters::default()),
previous_hash: None,
previous_issuer: None,
inner_hash: None,
dividend: Some(10),
identities: Vec::new(),
joiners: Vec::new(),
actives: Vec::new(),
leavers: Vec::new(),
revoked: Vec::new(),
excluded: Vec::new(),
certifications: Vec::new(),
transactions: Vec::new(),
}
}
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