pub struct Transaction {
pub nonce: u64, pub data: Vec<u8>, }
impl Transaction {
pub fn new(data: Vec<u8>, nonce: u64) -> Self {
assert!(data.len() < 1024, "Data too large"); Transaction { data, nonce }
}
pub fn is_valid_nonce(&self, current_nonce: u64) -> Result<(), &'static str> {
if self.nonce != current_nonce {
Err("Invalid nonce") } else {
Ok(()) }
}
}