Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block consensus encoding and decoding does not work #4535

Closed
SWvheerden opened this issue Aug 25, 2022 · 0 comments
Closed

Block consensus encoding and decoding does not work #4535

SWvheerden opened this issue Aug 25, 2022 · 0 comments

Comments

@SWvheerden
Copy link
Collaborator

Add the following test the block.rs, it should work:

#[cfg(test)]
mod test {
    use super::*;
    use crate::blocks::genesis_block::get_genesis_block;
    use crate::consensus::{ConsensusDecoding};
    use tari_common::configuration::Network;

    #[test]
    fn block_encode_decode(){
        let block = get_genesis_block(Network::LocalNet).block().clone();
        let mut block_bytes = Vec::new();
        block.consensus_encode(&mut block_bytes).unwrap();
        let decoded_block =  Block::consensus_decode(&mut block_bytes.as_slice()).unwrap();
        assert_eq!(block, decoded_block);

    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant