Fix for rustc RFC 1214; also add missing docs

This commit is contained in:
Andrew Poelstra 2015-09-20 15:27:12 -05:00
parent 00421970a1
commit 14db7ee902
4 changed files with 11 additions and 3 deletions

View File

@ -31,10 +31,15 @@ use util::misc::hex_bytes;
use util::hash::MerkleRoot;
use util::uint::Uint256;
/// The maximum allowable sequence number
pub static MAX_SEQUENCE: u32 = 0xFFFFFFFF;
/// How many satoshis are in "one bitcoin"
pub static COIN_VALUE: u64 = 100_000_000;
/// How many seconds between blocks we expect on average
pub static TARGET_BLOCK_SPACING: u32 = 600;
/// How many blocks between diffchanges
pub static DIFFCHANGE_INTERVAL: u32 = 2016;
/// How much time on average should occur between diffchanges
pub static DIFFCHANGE_TIMESPAN: u32 = 14 * 24 * 3600;
/// In Bitcoind this is insanely described as ~((u256)0 >> 32)

View File

@ -32,8 +32,11 @@ user_enum! {
}
}
/// Version of the protocol as appearing in network message headers
pub const PROTOCOL_VERSION: u32 = 70001;
/// Bitfield of services provided by this node
pub const SERVICES: u64 = 0;
/// User agent as it appears in the version message
pub const USER_AGENT: &'static str = "bitcoin-rust v0.1";
/// Return the network magic bytes, which should be encoded little-endian

View File

@ -37,13 +37,13 @@ use util::hash::Sha256dHash;
use network::serialize::{SimpleDecoder, SimpleEncoder};
/// Data which can be encoded in a consensus-consistent way
pub trait ConsensusEncodable<S: SimpleEncoder> {
pub trait ConsensusEncodable<S: SimpleEncoder> : Sized {
/// Encode an object with a well-defined format
fn consensus_encode(&self, e: &mut S) -> Result<(), S::Error>;
}
/// Data which can be encoded in a consensus-consistent way
pub trait ConsensusDecodable<D: SimpleDecoder> {
pub trait ConsensusDecodable<D: SimpleDecoder>: Sized {
/// Decode an object with a well-defined format
fn consensus_decode(d: &mut D) -> Result<Self, D::Error>;
}

View File

@ -63,7 +63,7 @@ impl<I: Iterator> Pair<I> {
}
/// Returns an iterator that returns elements of the original iterator 2 at a time
pub trait Pairable {
pub trait Pairable : Sized {
/// Returns an iterator that returns elements of the original iterator 2 at a time
fn pair(self) -> Pair<Self>;
}