Show -> Debug
This commit is contained in:
parent
df065c143b
commit
11dbc717c4
|
@ -32,7 +32,7 @@ use blockdata::transaction::Transaction;
|
||||||
|
|
||||||
/// A block header, which contains all the block's information except
|
/// A block header, which contains all the block's information except
|
||||||
/// the actual transactions
|
/// the actual transactions
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct BlockHeader {
|
pub struct BlockHeader {
|
||||||
/// The protocol version. Should always be 1.
|
/// The protocol version. Should always be 1.
|
||||||
pub version: u32,
|
pub version: u32,
|
||||||
|
@ -51,7 +51,7 @@ pub struct BlockHeader {
|
||||||
|
|
||||||
/// A Bitcoin block, which is a collection of transactions with an attached
|
/// A Bitcoin block, which is a collection of transactions with an attached
|
||||||
/// proof of work.
|
/// proof of work.
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
/// The block header
|
/// The block header
|
||||||
pub header: BlockHeader,
|
pub header: BlockHeader,
|
||||||
|
@ -61,7 +61,7 @@ pub struct Block {
|
||||||
|
|
||||||
/// A block header with txcount attached, which is given in the `headers`
|
/// A block header with txcount attached, which is given in the `headers`
|
||||||
/// network message.
|
/// network message.
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct LoneBlockHeader {
|
pub struct LoneBlockHeader {
|
||||||
/// The actual block header
|
/// The actual block header
|
||||||
pub header: BlockHeader,
|
pub header: BlockHeader,
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub mod all {
|
||||||
// write an #[inline] helper function which casts to u8s.
|
// write an #[inline] helper function which casts to u8s.
|
||||||
|
|
||||||
/// A script Opcode
|
/// A script Opcode
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Opcode {
|
pub enum Opcode {
|
||||||
/// Push an empty array onto the stack
|
/// Push an empty array onto the stack
|
||||||
|
@ -632,7 +632,7 @@ pub mod all {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Broad categories of opcodes with similar behavior
|
/// Broad categories of opcodes with similar behavior
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum OpcodeClass {
|
pub enum OpcodeClass {
|
||||||
/// Pushes the given number onto the stack
|
/// Pushes the given number onto the stack
|
||||||
PushNum(isize),
|
PushNum(isize),
|
||||||
|
@ -658,7 +658,7 @@ macro_rules! ordinary_opcode {
|
||||||
($($op:ident),*) => (
|
($($op:ident),*) => (
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum Opcode {
|
pub enum Opcode {
|
||||||
$( $op = all::$op as u8 ),*
|
$( $op = all::$op as u8 ),*
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ use util::hash::Sha256dHash;
|
||||||
use util::misc::script_find_and_remove;
|
use util::misc::script_find_and_remove;
|
||||||
use util::thinvec::ThinVec;
|
use util::thinvec::ThinVec;
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Show, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
/// A Bitcoin script
|
/// A Bitcoin script
|
||||||
pub struct Script(ThinVec<u8>);
|
pub struct Script(ThinVec<u8>);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ impl<S: hash::Writer> hash::Hash<S> for Script {
|
||||||
/// Ways that a script might fail. Not everything is split up as
|
/// Ways that a script might fail. Not everything is split up as
|
||||||
/// much as it could be; patches welcome if more detailed errors
|
/// much as it could be; patches welcome if more detailed errors
|
||||||
/// would help you.
|
/// would help you.
|
||||||
#[derive(PartialEq, Eq, Show, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
pub enum ScriptError {
|
pub enum ScriptError {
|
||||||
/// The script returns false no matter the input
|
/// The script returns false no matter the input
|
||||||
AnalyzeAlwaysReturnsFalse,
|
AnalyzeAlwaysReturnsFalse,
|
||||||
|
@ -1204,7 +1204,7 @@ impl json::ToJson for ScriptError {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single iteration of a script execution
|
/// A single iteration of a script execution
|
||||||
#[derive(PartialEq, Eq, Show, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct TraceIteration {
|
pub struct TraceIteration {
|
||||||
index: usize,
|
index: usize,
|
||||||
op_count: usize,
|
op_count: usize,
|
||||||
|
@ -1216,7 +1216,7 @@ pub struct TraceIteration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A full trace of a script execution
|
/// A full trace of a script execution
|
||||||
#[derive(PartialEq, Eq, Show, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct ScriptTrace {
|
pub struct ScriptTrace {
|
||||||
/// A copy of the script
|
/// A copy of the script
|
||||||
pub script: Script,
|
pub script: Script,
|
||||||
|
@ -1232,7 +1232,7 @@ impl_json!(TraceIteration, index, opcode, op_count, executed, errored, effect, s
|
||||||
|
|
||||||
/// Hashtype of a transaction, encoded in the last byte of a signature,
|
/// Hashtype of a transaction, encoded in the last byte of a signature,
|
||||||
/// specifically in the last 5 bits `byte & 31`
|
/// specifically in the last 5 bits `byte & 31`
|
||||||
#[derive(PartialEq, Eq, Show, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
pub enum SignatureHashType {
|
pub enum SignatureHashType {
|
||||||
/// 0x1: Sign all outputs
|
/// 0x1: Sign all outputs
|
||||||
SigHashAll,
|
SigHashAll,
|
||||||
|
@ -1264,7 +1264,7 @@ impl SignatureHashType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A structure that can hold either a slice or vector, as necessary
|
/// A structure that can hold either a slice or vector, as necessary
|
||||||
#[derive(Clone, Show)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum MaybeOwned<'a> {
|
pub enum MaybeOwned<'a> {
|
||||||
/// Freshly allocated memory
|
/// Freshly allocated memory
|
||||||
Owned(Vec<u8>),
|
Owned(Vec<u8>),
|
||||||
|
|
|
@ -35,7 +35,7 @@ use network::constants::Network;
|
||||||
use wallet::address::Address;
|
use wallet::address::Address;
|
||||||
|
|
||||||
/// A transaction input, which defines old coins to be consumed
|
/// A transaction input, which defines old coins to be consumed
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct TxIn {
|
pub struct TxIn {
|
||||||
/// The hash of the transaction whose output is being used an an input
|
/// The hash of the transaction whose output is being used an an input
|
||||||
pub prev_hash: Sha256dHash,
|
pub prev_hash: Sha256dHash,
|
||||||
|
@ -52,7 +52,7 @@ pub struct TxIn {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A transaction output, which defines new coins to be created from old ones.
|
/// A transaction output, which defines new coins to be created from old ones.
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct TxOut {
|
pub struct TxOut {
|
||||||
/// The value of the output, in satoshis
|
/// The value of the output, in satoshis
|
||||||
pub value: u64,
|
pub value: u64,
|
||||||
|
@ -89,7 +89,7 @@ impl TxOut {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Bitcoin transaction, which describes an authenticated movement of coins
|
/// A Bitcoin transaction, which describes an authenticated movement of coins
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Transaction {
|
pub struct Transaction {
|
||||||
/// The protocol version, should always be 1.
|
/// The protocol version, should always be 1.
|
||||||
pub version: u32,
|
pub version: u32,
|
||||||
|
@ -103,7 +103,7 @@ pub struct Transaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A transaction error
|
/// A transaction error
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub enum TransactionError {
|
pub enum TransactionError {
|
||||||
/// Concatenated script failed in the input half (script error)
|
/// Concatenated script failed in the input half (script error)
|
||||||
InputScriptFailure(ScriptError),
|
InputScriptFailure(ScriptError),
|
||||||
|
@ -130,7 +130,7 @@ impl json::ToJson for TransactionError {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trace of a transaction input's script execution
|
/// A trace of a transaction input's script execution
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct InputTrace {
|
pub struct InputTrace {
|
||||||
input_txid: Sha256dHash,
|
input_txid: Sha256dHash,
|
||||||
input_vout: usize,
|
input_vout: usize,
|
||||||
|
@ -145,7 +145,7 @@ impl_json!(InputTrace, input_txid, input_vout, sig_trace,
|
||||||
pubkey_trace, p2sh_trace, error);
|
pubkey_trace, p2sh_trace, error);
|
||||||
|
|
||||||
/// A trace of a transaction's execution
|
/// A trace of a transaction's execution
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct TransactionTrace {
|
pub struct TransactionTrace {
|
||||||
txid: Sha256dHash,
|
txid: Sha256dHash,
|
||||||
inputs: Vec<InputTrace>
|
inputs: Vec<InputTrace>
|
||||||
|
|
|
@ -36,7 +36,7 @@ use util::hash::{DumbHasher, Sha256dHash};
|
||||||
use util::thinvec::ThinVec;
|
use util::thinvec::ThinVec;
|
||||||
|
|
||||||
/// The amount of validation to do when updating the UTXO set
|
/// The amount of validation to do when updating the UTXO set
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Show)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug)]
|
||||||
pub enum ValidationLevel {
|
pub enum ValidationLevel {
|
||||||
/// Blindly update the UTXO set (NOT recommended)
|
/// Blindly update the UTXO set (NOT recommended)
|
||||||
NoValidation,
|
NoValidation,
|
||||||
|
@ -49,7 +49,7 @@ pub enum ValidationLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An error returned from a UTXO set operation
|
/// An error returned from a UTXO set operation
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub enum UtxoSetError {
|
pub enum UtxoSetError {
|
||||||
/// prevhash of the new block is not the hash of the old block (expected, actual)
|
/// prevhash of the new block is not the hash of the old block (expected, actual)
|
||||||
BadPrevHash(Sha256dHash, Sha256dHash),
|
BadPrevHash(Sha256dHash, Sha256dHash),
|
||||||
|
|
|
@ -192,7 +192,7 @@ macro_rules! impl_array_newtype_encodable {
|
||||||
|
|
||||||
macro_rules! impl_array_newtype_show {
|
macro_rules! impl_array_newtype_show {
|
||||||
($thing:ident) => {
|
($thing:ident) => {
|
||||||
impl ::std::fmt::Show for $thing {
|
impl ::std::fmt::Debug for $thing {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||||
write!(f, concat!(stringify!($thing), "({})"), self.as_slice())
|
write!(f, concat!(stringify!($thing), "({})"), self.as_slice())
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ macro_rules! user_enum {
|
||||||
$(#[$doc] $elem),*
|
$(#[$doc] $elem),*
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Show for $name {
|
impl ::std::fmt::Debug for $name {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||||
f.pad(match *self {
|
f.pad(match *self {
|
||||||
$($elem => $txt),*
|
$($elem => $txt),*
|
||||||
|
|
|
@ -61,7 +61,7 @@ impl<D:SimpleDecoder<E>, E> ConsensusDecodable<D, E> for Address {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for Address {
|
impl fmt::Debug for Address {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
// TODO: render services and hex-ize address
|
// TODO: render services and hex-ize address
|
||||||
write!(f, "Address {{services: {}, address: {}, port: {}}}",
|
write!(f, "Address {{services: {}, address: {}, port: {}}}",
|
||||||
|
|
|
@ -51,11 +51,11 @@ pub trait ConsensusDecodable<D:SimpleDecoder<E>, E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A variable-length unsigned integer
|
/// A variable-length unsigned integer
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Show)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug)]
|
||||||
pub struct VarInt(pub u64);
|
pub struct VarInt(pub u64);
|
||||||
|
|
||||||
/// Data which must be preceded by a 4-byte checksum
|
/// Data which must be preceded by a 4-byte checksum
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct CheckedData(pub Vec<u8>);
|
pub struct CheckedData(pub Vec<u8>);
|
||||||
|
|
||||||
// Primitive types
|
// Primitive types
|
||||||
|
|
|
@ -34,7 +34,7 @@ use network::serialize::{serialize, RawDecoder, SimpleEncoder, SimpleDecoder};
|
||||||
use util::misc::prepend_err;
|
use util::misc::prepend_err;
|
||||||
|
|
||||||
/// Serializer for command string
|
/// Serializer for command string
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct CommandString(pub String);
|
pub struct CommandString(pub String);
|
||||||
|
|
||||||
impl<S:SimpleEncoder<E>, E> ConsensusEncodable<S, E> for CommandString {
|
impl<S:SimpleEncoder<E>, E> ConsensusEncodable<S, E> for CommandString {
|
||||||
|
@ -72,7 +72,7 @@ pub enum SocketResponse {
|
||||||
ConnectionFailed(IoError, Sender<()>)
|
ConnectionFailed(IoError, Sender<()>)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
/// A Network message payload. Proper documentation is available on the Bitcoin
|
/// A Network message payload. Proper documentation is available on the Bitcoin
|
||||||
/// wiki https://en.bitcoin.it/wiki/Protocol_specification
|
/// wiki https://en.bitcoin.it/wiki/Protocol_specification
|
||||||
pub enum NetworkMessage {
|
pub enum NetworkMessage {
|
||||||
|
|
|
@ -23,7 +23,7 @@ use network::encodable::{ConsensusDecodable, ConsensusEncodable};
|
||||||
use network::serialize::{SimpleDecoder, SimpleEncoder};
|
use network::serialize::{SimpleDecoder, SimpleEncoder};
|
||||||
use util::hash::Sha256dHash;
|
use util::hash::Sha256dHash;
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
/// The type of an inventory object
|
/// The type of an inventory object
|
||||||
pub enum InvType {
|
pub enum InvType {
|
||||||
/// Error --- these inventories can be ignored
|
/// Error --- these inventories can be ignored
|
||||||
|
@ -37,7 +37,7 @@ pub enum InvType {
|
||||||
// Some simple messages
|
// Some simple messages
|
||||||
|
|
||||||
/// The `getblocks` message
|
/// The `getblocks` message
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct GetBlocksMessage {
|
pub struct GetBlocksMessage {
|
||||||
/// The protocol version
|
/// The protocol version
|
||||||
pub version: u32,
|
pub version: u32,
|
||||||
|
@ -50,7 +50,7 @@ pub struct GetBlocksMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The `getheaders` message
|
/// The `getheaders` message
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct GetHeadersMessage {
|
pub struct GetHeadersMessage {
|
||||||
/// The protocol version
|
/// The protocol version
|
||||||
pub version: u32,
|
pub version: u32,
|
||||||
|
@ -63,7 +63,7 @@ pub struct GetHeadersMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An inventory object --- a reference to a Bitcoin object
|
/// An inventory object --- a reference to a Bitcoin object
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct Inventory {
|
pub struct Inventory {
|
||||||
/// The type of object that is referenced
|
/// The type of object that is referenced
|
||||||
pub inv_type: InvType,
|
pub inv_type: InvType,
|
||||||
|
|
|
@ -27,7 +27,7 @@ use network::socket::Socket;
|
||||||
/// Some simple messages
|
/// Some simple messages
|
||||||
|
|
||||||
/// The `version` message
|
/// The `version` message
|
||||||
#[derive(PartialEq, Eq, Clone, Show)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct VersionMessage {
|
pub struct VersionMessage {
|
||||||
/// The P2P network protocol version
|
/// The P2P network protocol version
|
||||||
pub version: u32,
|
pub version: u32,
|
||||||
|
|
|
@ -21,7 +21,7 @@ use util::thinvec::ThinVec;
|
||||||
use util::hash::Sha256dHash;
|
use util::hash::Sha256dHash;
|
||||||
|
|
||||||
/// An error that might occur during base58 decoding
|
/// An error that might occur during base58 decoding
|
||||||
#[derive(Show, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
pub enum Base58Error {
|
pub enum Base58Error {
|
||||||
/// Invalid character encountered
|
/// Invalid character encountered
|
||||||
BadByte(u8),
|
BadByte(u8),
|
||||||
|
|
|
@ -22,7 +22,7 @@ use std::io::IoError;
|
||||||
pub type BitcoinResult<T> = Result<T, BitcoinError>;
|
pub type BitcoinResult<T> = Result<T, BitcoinError>;
|
||||||
|
|
||||||
/// A general error code
|
/// A general error code
|
||||||
#[derive(PartialEq, Eq, Show, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
pub enum BitcoinError {
|
pub enum BitcoinError {
|
||||||
/// An I/O error
|
/// An I/O error
|
||||||
InputOutput(IoError),
|
InputOutput(IoError),
|
||||||
|
|
|
@ -37,7 +37,7 @@ use util::uint::Uint256;
|
||||||
pub struct Sha256dHash([u8; 32]);
|
pub struct Sha256dHash([u8; 32]);
|
||||||
impl_array_newtype!(Sha256dHash, u8, 32);
|
impl_array_newtype!(Sha256dHash, u8, 32);
|
||||||
|
|
||||||
impl ::std::fmt::Show for Sha256dHash {
|
impl ::std::fmt::Debug for Sha256dHash {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||||
write!(f, "{}", self.be_hex_string().as_slice())
|
write!(f, "{}", self.be_hex_string().as_slice())
|
||||||
}
|
}
|
||||||
|
@ -50,22 +50,22 @@ impl_array_newtype!(Ripemd160Hash, u8, 20);
|
||||||
/// A "hasher" which just truncates and adds data to its state. Should
|
/// A "hasher" which just truncates and adds data to its state. Should
|
||||||
/// only be used for hashtables indexed by "already random" data such
|
/// only be used for hashtables indexed by "already random" data such
|
||||||
/// as SHA2 hashes
|
/// as SHA2 hashes
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct DumbHasher;
|
pub struct DumbHasher;
|
||||||
|
|
||||||
/// The state of a `DumbHasher`
|
/// The state of a `DumbHasher`
|
||||||
pub struct DumbHasherState([u8; 8]);
|
pub struct DumbHasherState([u8; 8]);
|
||||||
|
|
||||||
/// A 32-bit hash obtained by truncating a real hash
|
/// A 32-bit hash obtained by truncating a real hash
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Hash32((u8, u8, u8, u8));
|
pub struct Hash32((u8, u8, u8, u8));
|
||||||
|
|
||||||
/// A 48-bit hash obtained by truncating a real hash
|
/// A 48-bit hash obtained by truncating a real hash
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Hash48((u8, u8, u8, u8, u8, u8));
|
pub struct Hash48((u8, u8, u8, u8, u8, u8));
|
||||||
|
|
||||||
/// A 64-bit hash obtained by truncating a real hash
|
/// A 64-bit hash obtained by truncating a real hash
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Hash64((u8, u8, u8, u8, u8, u8, u8, u8));
|
pub struct Hash64((u8, u8, u8, u8, u8, u8, u8, u8));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
//! strings; a Patricia tree uses bitstrings.
|
//! strings; a Patricia tree uses bitstrings.
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use core::fmt::Show;
|
use core::fmt::Debug;
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use std::kinds::marker;
|
use std::kinds::marker;
|
||||||
use std::num::{Zero, One};
|
use std::num::{Zero, One};
|
||||||
|
@ -351,10 +351,10 @@ impl<K:BitArray+Eq+Zero+One+BitXor<K,K>+Shl<usize,K>+Shr<usize,K>, V> PatriciaTr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K:BitArray, V:Show> PatriciaTree<K, V> {
|
impl<K:BitArray, V:Debug> PatriciaTree<K, V> {
|
||||||
/// Print the entire tree
|
/// Print the entire tree
|
||||||
pub fn print<'a>(&'a self) {
|
pub fn print<'a>(&'a self) {
|
||||||
fn recurse<'a, K:BitArray, V:Show>(tree: &'a PatriciaTree<K, V>, depth: usize) {
|
fn recurse<'a, K:BitArray, V:Debug>(tree: &'a PatriciaTree<K, V>, depth: usize) {
|
||||||
for i in range(0, tree.skip_len as usize) {
|
for i in range(0, tree.skip_len as usize) {
|
||||||
print!("{:}", if tree.skip_prefix.bit(i) { 1 } else { 0 });
|
print!("{:}", if tree.skip_prefix.bit(i) { 1 } else { 0 });
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,7 +252,7 @@ impl<T> Collection for ThinVec<T> {
|
||||||
fn len(&self) -> usize { self.cap as usize }
|
fn len(&self) -> usize { self.cap as usize }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:fmt::Show> fmt::Show for ThinVec<T> {
|
impl<T:fmt::Debug> fmt::Debug for ThinVec<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
self.as_slice().fmt(f)
|
self.as_slice().fmt(f)
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ macro_rules! construct_uint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for $name {
|
impl fmt::Debug for $name {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
use std::fmt::WriteError;
|
use std::fmt::WriteError;
|
||||||
use network::encodable::ConsensusEncodable;
|
use network::encodable::ConsensusEncodable;
|
||||||
|
|
|
@ -116,7 +116,7 @@ impl FromBase58 for Address {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Show for Address {
|
impl ::std::fmt::Debug for Address {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||||
write!(f, "{}", self.to_base58check())
|
write!(f, "{}", self.to_base58check())
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ use wallet::wallet::Wallet;
|
||||||
use util::hash::{DumbHasher, Sha256dHash};
|
use util::hash::{DumbHasher, Sha256dHash};
|
||||||
|
|
||||||
/// The type of a wallet-spendable txout
|
/// The type of a wallet-spendable txout
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum WalletTxOutType {
|
pub enum WalletTxOutType {
|
||||||
/// Pay-to-address transaction redeemable using an ECDSA key
|
/// Pay-to-address transaction redeemable using an ECDSA key
|
||||||
PayToAddress(SecretKey),
|
PayToAddress(SecretKey),
|
||||||
|
@ -43,7 +43,7 @@ pub enum WalletTxOutType {
|
||||||
|
|
||||||
|
|
||||||
/// A txout that is spendable by the wallet
|
/// A txout that is spendable by the wallet
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct WalletTxOut {
|
pub struct WalletTxOut {
|
||||||
/// The TXID of the transaction this output is part of
|
/// The TXID of the transaction this output is part of
|
||||||
pub txid: Sha256dHash,
|
pub txid: Sha256dHash,
|
||||||
|
@ -58,7 +58,7 @@ pub struct WalletTxOut {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An address index
|
/// An address index
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct AddressIndex {
|
pub struct AddressIndex {
|
||||||
tentative_index: HashMap<Script, Vec<WalletTxOut>>,
|
tentative_index: HashMap<Script, Vec<WalletTxOut>>,
|
||||||
index: HashMap<(Sha256dHash, u32), Vec<WalletTxOut>, DumbHasher>,
|
index: HashMap<(Sha256dHash, u32), Vec<WalletTxOut>, DumbHasher>,
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl Default for Fingerprint {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extended private key
|
/// Extended private key
|
||||||
#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Show)]
|
#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
|
||||||
pub struct ExtendedPrivKey {
|
pub struct ExtendedPrivKey {
|
||||||
/// The network this key is to be used on
|
/// The network this key is to be used on
|
||||||
pub network: Network,
|
pub network: Network,
|
||||||
|
@ -68,7 +68,7 @@ pub struct ExtendedPrivKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extended public key
|
/// Extended public key
|
||||||
#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Show)]
|
#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
|
||||||
pub struct ExtendedPubKey {
|
pub struct ExtendedPubKey {
|
||||||
/// The network this key is to be used on
|
/// The network this key is to be used on
|
||||||
pub network: Network,
|
pub network: Network,
|
||||||
|
@ -85,7 +85,7 @@ pub struct ExtendedPubKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A child number for a derived key
|
/// A child number for a derived key
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum ChildNumber {
|
pub enum ChildNumber {
|
||||||
/// Hardened key index, within [0, 2^31 - 1]
|
/// Hardened key index, within [0, 2^31 - 1]
|
||||||
Hardened(u32),
|
Hardened(u32),
|
||||||
|
@ -114,7 +114,7 @@ impl<D: Decoder<E>, E> Decodable<D, E> for ChildNumber {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A BIP32 error
|
/// A BIP32 error
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// A pk->pk derivation was attempted on a hardened key
|
/// A pk->pk derivation was attempted on a hardened key
|
||||||
CannotDeriveFromHardenedKey,
|
CannotDeriveFromHardenedKey,
|
||||||
|
|
|
@ -31,7 +31,7 @@ use wallet::address::Address;
|
||||||
use wallet::address_index::AddressIndex;
|
use wallet::address_index::AddressIndex;
|
||||||
|
|
||||||
/// A Wallet error
|
/// A Wallet error
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Tried to lookup an account by name, but none was found
|
/// Tried to lookup an account by name, but none was found
|
||||||
AccountNotFound,
|
AccountNotFound,
|
||||||
|
@ -54,7 +54,7 @@ pub enum AccountChain {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An account
|
/// An account
|
||||||
#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Show)]
|
#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
|
||||||
pub struct Account {
|
pub struct Account {
|
||||||
name: String,
|
name: String,
|
||||||
internal_path: Vec<ChildNumber>,
|
internal_path: Vec<ChildNumber>,
|
||||||
|
@ -80,7 +80,7 @@ impl Default for Account {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A wallet
|
/// A wallet
|
||||||
#[derive(Clone, PartialEq, Eq, Show)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct Wallet {
|
pub struct Wallet {
|
||||||
master: ExtendedPrivKey,
|
master: ExtendedPrivKey,
|
||||||
accounts: HashMap<String, Account>,
|
accounts: HashMap<String, Account>,
|
||||||
|
|
Loading…
Reference in New Issue