1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0

#![forbid(unsafe_code)]

use consensus_types::block::Block;
use libra_crypto::HashValue;
use libra_types::transaction::Transaction;

mod execution_correctness;
mod execution_correctness_manager;
mod local;
mod process;
mod remote_service;
mod serializer;
mod thread;

pub use crate::{
    execution_correctness::ExecutionCorrectness,
    execution_correctness_manager::ExecutionCorrectnessManager, process::Process,
};

#[cfg(test)]
mod tests;

fn id_and_transactions_from_block(block: &Block) -> (HashValue, Vec<Transaction>) {
    let id = block.id();
    let mut transactions = vec![Transaction::BlockMetadata(block.into())];
    transactions.extend(
        block
            .payload()
            .unwrap_or(&vec![])
            .iter()
            .map(|txn| Transaction::UserTransaction(txn.clone())),
    );
    (id, transactions)
}