all fields of bitcoin messages -> public
This commit is contained in:
parent
eb6c0aefa7
commit
49628a3d2c
|
@ -7,12 +7,12 @@ use hash::H256;
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
pub struct BlockHeader {
|
pub struct BlockHeader {
|
||||||
version: u32,
|
pub version: u32,
|
||||||
previous_header_hash: H256,
|
pub previous_header_hash: H256,
|
||||||
merkle_root_hash: H256,
|
pub merkle_root_hash: H256,
|
||||||
time: u32,
|
pub time: u32,
|
||||||
nbits: u32,
|
pub nbits: u32,
|
||||||
nonce: u32,
|
pub nonce: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for BlockHeader {
|
impl fmt::Debug for BlockHeader {
|
||||||
|
|
|
@ -4,10 +4,10 @@ use common::PrefilledTransaction;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct BlockHeaderAndIDs {
|
pub struct BlockHeaderAndIDs {
|
||||||
header: BlockHeader,
|
pub header: BlockHeader,
|
||||||
nonce: u64,
|
pub nonce: u64,
|
||||||
short_ids: Vec<ShortTransactionID>,
|
pub short_ids: Vec<ShortTransactionID>,
|
||||||
prefilled_transactions: Vec<PrefilledTransaction>,
|
pub prefilled_transactions: Vec<PrefilledTransaction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Serializable for BlockHeaderAndIDs {
|
impl Serializable for BlockHeaderAndIDs {
|
||||||
|
|
|
@ -4,8 +4,8 @@ use chain::Transaction;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct BlockTransactions {
|
pub struct BlockTransactions {
|
||||||
blockhash: H256,
|
pub blockhash: H256,
|
||||||
transactions: Vec<Transaction>,
|
pub transactions: Vec<Transaction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Serializable for BlockTransactions {
|
impl Serializable for BlockTransactions {
|
||||||
|
|
|
@ -6,8 +6,8 @@ use ser::{
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct BlockTransactionsRequest {
|
pub struct BlockTransactionsRequest {
|
||||||
blockhash: H256,
|
pub blockhash: H256,
|
||||||
indexes: Vec<usize>,
|
pub indexes: Vec<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Serializable for BlockTransactionsRequest {
|
impl Serializable for BlockTransactionsRequest {
|
||||||
|
|
|
@ -6,8 +6,8 @@ use chain::Transaction;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct PrefilledTransaction {
|
pub struct PrefilledTransaction {
|
||||||
index: usize,
|
pub index: usize,
|
||||||
transaction: Transaction,
|
pub transaction: Transaction,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Serializable for PrefilledTransaction {
|
impl Serializable for PrefilledTransaction {
|
||||||
|
|
|
@ -4,7 +4,7 @@ use {MessageResult, Payload};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct BlockTxn {
|
pub struct BlockTxn {
|
||||||
request: BlockTransactions,
|
pub request: BlockTransactions,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for BlockTxn {
|
impl Payload for BlockTxn {
|
||||||
|
|
|
@ -4,7 +4,7 @@ use {Payload, MessageResult};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct CompactBlock {
|
pub struct CompactBlock {
|
||||||
header: BlockHeaderAndIDs,
|
pub header: BlockHeaderAndIDs,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for CompactBlock {
|
impl Payload for CompactBlock {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use {Payload, MessageResult};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct FeeFilter {
|
pub struct FeeFilter {
|
||||||
fee_rate: u64,
|
pub fee_rate: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for FeeFilter {
|
impl Payload for FeeFilter {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use {Payload, MessageResult};
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct FilterAdd {
|
pub struct FilterAdd {
|
||||||
// TODO: check how this should be serialized
|
// TODO: check how this should be serialized
|
||||||
data: Bytes,
|
pub data: Bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for FilterAdd {
|
impl Payload for FilterAdd {
|
||||||
|
|
|
@ -5,10 +5,10 @@ use {Payload, MessageResult};
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct FilterLoad {
|
pub struct FilterLoad {
|
||||||
// TODO: check how this should be serialized
|
// TODO: check how this should be serialized
|
||||||
filter: Bytes,
|
pub filter: Bytes,
|
||||||
hash_functions: u32,
|
pub hash_functions: u32,
|
||||||
tweak: u32,
|
pub tweak: u32,
|
||||||
flags: u8,
|
pub flags: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for FilterLoad {
|
impl Payload for FilterLoad {
|
||||||
|
|
|
@ -4,9 +4,9 @@ use {Payload, MessageResult};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct GetBlocks {
|
pub struct GetBlocks {
|
||||||
version: u32,
|
pub version: u32,
|
||||||
block_locator_hashes: Vec<H256>,
|
pub block_locator_hashes: Vec<H256>,
|
||||||
hash_stop: H256,
|
pub hash_stop: H256,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for GetBlocks {
|
impl Payload for GetBlocks {
|
||||||
|
|
|
@ -4,7 +4,7 @@ use {Payload, MessageResult};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct GetBlockTxn {
|
pub struct GetBlockTxn {
|
||||||
request: BlockTransactionsRequest,
|
pub request: BlockTransactionsRequest,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for GetBlockTxn {
|
impl Payload for GetBlockTxn {
|
||||||
|
|
|
@ -4,9 +4,9 @@ use {Payload, MessageResult};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct GetHeaders {
|
pub struct GetHeaders {
|
||||||
version: u32,
|
pub version: u32,
|
||||||
block_locator_hashes: Vec<H256>,
|
pub block_locator_hashes: Vec<H256>,
|
||||||
hash_stop: H256,
|
pub hash_stop: H256,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for GetHeaders {
|
impl Payload for GetHeaders {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use {Payload, MessageResult};
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct Headers {
|
pub struct Headers {
|
||||||
// TODO: Block headers need to have txn_count field
|
// TODO: Block headers need to have txn_count field
|
||||||
headers: Vec<BlockHeader>,
|
pub headers: Vec<BlockHeader>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for Headers {
|
impl Payload for Headers {
|
||||||
|
|
|
@ -6,10 +6,10 @@ use {Payload, MessageResult};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct MerkleBlock {
|
pub struct MerkleBlock {
|
||||||
block_header: BlockHeader,
|
pub block_header: BlockHeader,
|
||||||
total_transactions: u32,
|
pub total_transactions: u32,
|
||||||
hashes: Vec<H256>,
|
pub hashes: Vec<H256>,
|
||||||
flags: Bytes,
|
pub flags: Bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for MerkleBlock {
|
impl Payload for MerkleBlock {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use {Payload, MessageResult};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
enum RejectCode {
|
pub enum RejectCode {
|
||||||
Malformed = 0x01,
|
Malformed = 0x01,
|
||||||
Invalid = 0x10,
|
Invalid = 0x10,
|
||||||
Obsolate = 0x11,
|
Obsolate = 0x11,
|
||||||
|
@ -53,9 +53,9 @@ impl Deserializable for RejectCode {
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct Reject {
|
pub struct Reject {
|
||||||
message: String,
|
pub message: String,
|
||||||
code: RejectCode,
|
pub code: RejectCode,
|
||||||
reason: String,
|
pub reason: String,
|
||||||
// TODO: data
|
// TODO: data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ use {Payload, MessageResult};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct SendCompact {
|
pub struct SendCompact {
|
||||||
first: bool,
|
pub first: bool,
|
||||||
second: u64,
|
pub second: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Payload for SendCompact {
|
impl Payload for SendCompact {
|
||||||
|
|
Loading…
Reference in New Issue