-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BIP152: Add Compact Blocks network messages
- Loading branch information
1 parent
6ef1b59
commit b90cec7
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//! | ||
//! BIP152 Compact Blocks network messages | ||
//! | ||
|
||
use crate::util::bip152; | ||
|
||
/// sendcmpct message | ||
#[derive(PartialEq, Eq, Clone, Debug, Copy, PartialOrd, Ord, Hash)] | ||
pub struct SendCmpct { | ||
/// Request to be send compact blocks. | ||
pub send_compact: bool, | ||
/// Compact Blocks protocol version number. | ||
pub version: u64, | ||
} | ||
impl_consensus_encoding!(SendCmpct, send_compact, version); | ||
|
||
/// cmpctblock message | ||
/// | ||
/// Note that the rules for validation before relaying compact blocks is | ||
/// different from headers and regular block messages. Thus, you shouldn't use | ||
/// compact blocks when relying on an upstream full node to have validated data | ||
/// being forwarded to you. | ||
#[derive(PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)] | ||
pub struct CmpctBlock { | ||
/// The Compact Block. | ||
pub compact_block: bip152::HeaderAndShortIds, | ||
} | ||
impl_consensus_encoding!(CmpctBlock, compact_block); | ||
|
||
/// getblocktxn message | ||
#[derive(PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)] | ||
pub struct GetBlockTxn { | ||
/// The block transactions request. | ||
pub txs_request: bip152::BlockTransactionsRequest, | ||
} | ||
impl_consensus_encoding!(GetBlockTxn, txs_request); | ||
|
||
/// blocktxn message | ||
#[derive(PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)] | ||
pub struct BlockTxn { | ||
/// The requested block transactions. | ||
pub transactions: bip152::BlockTransactions, | ||
} | ||
impl_consensus_encoding!(BlockTxn, transactions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters