2015-11-24 22:21:15 +01:00
|
|
|
#[macro_use] extern crate log;
|
2015-11-26 21:34:49 +01:00
|
|
|
extern crate ethcore_util;
|
|
|
|
|
|
|
|
use ethcore_util::hash::*;
|
2015-11-27 13:18:35 +01:00
|
|
|
use ethcore_util::uint::*;
|
2015-11-26 21:34:49 +01:00
|
|
|
|
|
|
|
pub type LogBloom = Hash4096;
|
|
|
|
|
2015-11-27 13:18:35 +01:00
|
|
|
pub static ZERO_ADDRESS: Address = Address([0x00; 20]);
|
|
|
|
pub static ZERO_HASH256: Hash256 = Hash256([0x00; 32]);
|
|
|
|
pub static ZERO_LOGBLOOM: LogBloom = Hash4096([0x00; 512]);
|
2015-11-26 21:34:49 +01:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Header {
|
|
|
|
parent_hash: Hash256,
|
2015-11-27 13:18:35 +01:00
|
|
|
timestamp: U256,
|
|
|
|
number: U256,
|
2015-11-26 21:34:49 +01:00
|
|
|
author: Address,
|
|
|
|
|
|
|
|
transactions_root: Hash256,
|
|
|
|
uncles_hash: Hash256,
|
|
|
|
extra_data_hash: Hash256,
|
|
|
|
|
|
|
|
state_root: Hash256,
|
|
|
|
receipts_root: Hash256,
|
|
|
|
log_bloom: LogBloom,
|
2015-11-27 13:18:35 +01:00
|
|
|
gas_used: U256,
|
|
|
|
gas_limit: U256,
|
2015-11-26 21:34:49 +01:00
|
|
|
|
2015-11-27 13:18:35 +01:00
|
|
|
difficulty: U256,
|
2015-11-26 21:34:49 +01:00
|
|
|
seal: Vec<Bytes>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Header {
|
|
|
|
pub fn new() -> Header {
|
|
|
|
Header {
|
2015-11-27 13:18:35 +01:00
|
|
|
parent_hash: ZERO_HASH256,
|
|
|
|
timestamp: BAD_U256,
|
|
|
|
number: ZERO_U256,
|
2015-11-26 21:34:49 +01:00
|
|
|
author: ZERO_ADDRESS,
|
|
|
|
|
|
|
|
transactions_root: ZERO_HASH256,
|
|
|
|
uncles_hash: ZERO_HASH256,
|
|
|
|
extra_data_hash: ZERO_HASH256,
|
|
|
|
|
|
|
|
state_root: ZERO_HASH256,
|
|
|
|
receipts_root: ZERO_HASH256,
|
|
|
|
log_bloom: ZERO_LOGBLOOM,
|
2015-11-27 13:18:35 +01:00
|
|
|
gas_used: ZERO_U256,
|
|
|
|
gas_limit: ZERO_U256,
|
2015-11-26 21:34:49 +01:00
|
|
|
|
2015-11-27 13:18:35 +01:00
|
|
|
difficulty: ZERO_U256,
|
2015-11-26 21:34:49 +01:00
|
|
|
seal: vec![],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-11-24 22:21:15 +01:00
|
|
|
|
2015-11-27 00:30:33 +01:00
|
|
|
pub struct Transaction {
|
|
|
|
pub to: Address,
|
2015-11-27 13:18:35 +01:00
|
|
|
pub gas: U256,
|
2015-11-27 00:30:33 +01:00
|
|
|
pub data: Bytes,
|
|
|
|
pub code: Bytes,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn memorydb() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-24 22:21:15 +01:00
|
|
|
/// Silly function to return 69.
|
|
|
|
///
|
|
|
|
/// # Example
|
|
|
|
///
|
|
|
|
/// ```
|
|
|
|
/// assert_eq!(ethcore::sixtynine(), 69);
|
|
|
|
/// ```
|
|
|
|
pub fn sixtynine() -> i32 {
|
|
|
|
debug!("Hello world!");
|
|
|
|
69
|
2015-11-24 21:05:08 +01:00
|
|
|
}
|