mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-08 00:03:09 +00:00
setup for core
This commit is contained in:
parent
f1dcb6054c
commit
191019beaa
@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::merkle_tree_public::TreeHashType;
|
||||
|
||||
//ToDo: Update Nullifier model, when it is clear
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq)]
|
||||
///General nullifier object
|
||||
pub struct UTXONullifier {
|
||||
pub utxo_hash: TreeHashType,
|
||||
|
||||
@ -6,7 +6,7 @@ use storage::{merkle_tree_public::TreeHashType, nullifier::UTXONullifier, Accoun
|
||||
///Raw asset data
|
||||
pub type Asset = Vec<u8>;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
///Container for raw utxo payload
|
||||
pub struct UTXO {
|
||||
pub hash: TreeHashType,
|
||||
@ -53,3 +53,36 @@ impl UTXO {
|
||||
Ok(serde_json::from_slice(&self.asset)?)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use storage::{merkle_tree_public::TreeHashType, nullifier::UTXONullifier, AccountId};
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||
struct TestAsset {
|
||||
id: u32,
|
||||
name: String,
|
||||
}
|
||||
|
||||
fn sample_account() -> AccountId {
|
||||
AccountId::default()
|
||||
}
|
||||
|
||||
fn sample_nullifier() -> UTXONullifier {
|
||||
UTXONullifier::default()
|
||||
}
|
||||
|
||||
fn sample_tree_hash() -> TreeHashType {
|
||||
TreeHashType::default()
|
||||
}
|
||||
|
||||
fn sample_payload() -> UTXOPayload {
|
||||
UTXOPayload {
|
||||
owner: sample_account(),
|
||||
asset: serde_json::to_vec(&TestAsset { id: 1, name: "Test".to_string() }).unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user