diff --git a/src/blockdata/block.rs b/src/blockdata/block.rs index 873000e..1cccb6e 100644 --- a/src/blockdata/block.rs +++ b/src/blockdata/block.rs @@ -32,7 +32,7 @@ use blockdata::transaction::Transaction; /// A block header, which contains all the block's information except /// the actual transactions -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct BlockHeader { /// The protocol version. Should always be 1. pub version: u32, @@ -51,7 +51,7 @@ pub struct BlockHeader { /// A Bitcoin block, which is a collection of transactions with an attached /// proof of work. -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct Block { /// The block header pub header: BlockHeader, @@ -61,7 +61,7 @@ pub struct Block { /// A block header with txcount attached, which is given in the `headers` /// network message. -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct LoneBlockHeader { /// The actual block header pub header: BlockHeader, diff --git a/src/blockdata/opcodes.rs b/src/blockdata/opcodes.rs index e3f3b5a..7c61f99 100644 --- a/src/blockdata/opcodes.rs +++ b/src/blockdata/opcodes.rs @@ -38,7 +38,7 @@ pub mod all { // write an #[inline] helper function which casts to u8s. /// A script Opcode - #[deriving(Clone, PartialEq, Eq, Show)] + #[derive(Clone, PartialEq, Eq, Show)] #[repr(u8)] pub enum Opcode { /// Push an empty array onto the stack @@ -632,7 +632,7 @@ pub mod all { } /// Broad categories of opcodes with similar behavior -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub enum OpcodeClass { /// Pushes the given number onto the stack PushNum(isize), @@ -658,7 +658,7 @@ macro_rules! ordinary_opcode { ($($op:ident),*) => ( #[repr(u8)] #[doc(hidden)] - #[deriving(Clone, PartialEq, Eq, Show)] + #[derive(Clone, PartialEq, Eq, Show)] pub enum Opcode { $( $op = all::$op as u8 ),* } diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index 65ab097..9fc36d2 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -48,7 +48,7 @@ use util::hash::Sha256dHash; use util::misc::script_find_and_remove; use util::thinvec::ThinVec; -#[deriving(PartialEq, Eq, Show, Clone)] +#[derive(PartialEq, Eq, Show, Clone)] /// A Bitcoin script pub struct Script(ThinVec); @@ -63,7 +63,7 @@ impl hash::Hash for Script { /// Ways that a script might fail. Not everything is split up as /// much as it could be; patches welcome if more detailed errors /// would help you. -#[deriving(PartialEq, Eq, Show, Clone)] +#[derive(PartialEq, Eq, Show, Clone)] pub enum ScriptError { /// The script returns false no matter the input AnalyzeAlwaysReturnsFalse, @@ -721,7 +721,7 @@ fn update_op_checksig(elem: &mut AbstractStackElem, others: &[usize]) /// An abstract element on the stack, used to describe a satisfying /// script input -#[deriving(Clone)] +#[derive(Clone)] pub struct AbstractStackElem { /// The raw data, if known raw: Option>, @@ -1040,7 +1040,7 @@ impl AbstractStackElem { /// The stack used by the script satisfier -#[deriving(Clone)] +#[derive(Clone)] pub struct AbstractStack { /// Actual elements on the stack stack: Vec, @@ -1204,7 +1204,7 @@ impl json::ToJson for ScriptError { } /// A single iteration of a script execution -#[deriving(PartialEq, Eq, Show, Clone)] +#[derive(PartialEq, Eq, Show, Clone)] pub struct TraceIteration { index: usize, op_count: usize, @@ -1216,7 +1216,7 @@ pub struct TraceIteration { } /// A full trace of a script execution -#[deriving(PartialEq, Eq, Show, Clone)] +#[derive(PartialEq, Eq, Show, Clone)] pub struct ScriptTrace { /// A copy of the 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, /// specifically in the last 5 bits `byte & 31` -#[deriving(PartialEq, Eq, Show, Clone)] +#[derive(PartialEq, Eq, Show, Clone)] pub enum SignatureHashType { /// 0x1: Sign all outputs SigHashAll, @@ -1264,7 +1264,7 @@ impl SignatureHashType { } /// A structure that can hold either a slice or vector, as necessary -#[deriving(Clone, Show)] +#[derive(Clone, Show)] pub enum MaybeOwned<'a> { /// Freshly allocated memory Owned(Vec), diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index f900533..157a109 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -35,7 +35,7 @@ use network::constants::Network; use wallet::address::Address; /// A transaction input, which defines old coins to be consumed -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct TxIn { /// The hash of the transaction whose output is being used an an input pub prev_hash: Sha256dHash, @@ -52,7 +52,7 @@ pub struct TxIn { } /// A transaction output, which defines new coins to be created from old ones. -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct TxOut { /// The value of the output, in satoshis pub value: u64, @@ -89,7 +89,7 @@ impl TxOut { } /// A Bitcoin transaction, which describes an authenticated movement of coins -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct Transaction { /// The protocol version, should always be 1. pub version: u32, @@ -103,7 +103,7 @@ pub struct Transaction { } /// A transaction error -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub enum TransactionError { /// Concatenated script failed in the input half (script error) InputScriptFailure(ScriptError), @@ -130,7 +130,7 @@ impl json::ToJson for TransactionError { } /// A trace of a transaction input's script execution -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct InputTrace { input_txid: Sha256dHash, input_vout: usize, @@ -145,7 +145,7 @@ impl_json!(InputTrace, input_txid, input_vout, sig_trace, pubkey_trace, p2sh_trace, error); /// A trace of a transaction's execution -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct TransactionTrace { txid: Sha256dHash, inputs: Vec diff --git a/src/blockdata/utxoset.rs b/src/blockdata/utxoset.rs index 8dca43f..62c41ba 100644 --- a/src/blockdata/utxoset.rs +++ b/src/blockdata/utxoset.rs @@ -36,7 +36,7 @@ use util::hash::{DumbHasher, Sha256dHash}; use util::thinvec::ThinVec; /// The amount of validation to do when updating the UTXO set -#[deriving(PartialEq, Eq, PartialOrd, Ord, Clone, Show)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Show)] pub enum ValidationLevel { /// Blindly update the UTXO set (NOT recommended) NoValidation, @@ -49,7 +49,7 @@ pub enum ValidationLevel { } /// An error returned from a UTXO set operation -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub enum UtxoSetError { /// prevhash of the new block is not the hash of the old block (expected, actual) BadPrevHash(Sha256dHash, Sha256dHash), diff --git a/src/lib.rs b/src/lib.rs index 56f1ea4..d9d7b75 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,9 +33,6 @@ #![feature(unboxed_closure_sugar)] #![feature(unboxed_closures)] -#![comment = "Rust Bitcoin Library"] -#![license = "CC0"] - // Coding conventions #![warn(non_uppercase_statics)] #![deny(non_camel_case_types)] diff --git a/src/network/constants.rs b/src/network/constants.rs index 34ad148..7f40474 100644 --- a/src/network/constants.rs +++ b/src/network/constants.rs @@ -22,7 +22,7 @@ use network::encodable::{ConsensusDecodable, ConsensusEncodable}; use network::serialize::{SimpleEncoder, SimpleDecoder}; user_enum! { - #[deriving(PartialEq, Eq, Clone, Hash)] + #[derive(PartialEq, Eq, Clone, Hash)] #[doc="The cryptocurrency to act on"] pub enum Network { #[doc="Classic Bitcoin"] diff --git a/src/network/encodable.rs b/src/network/encodable.rs index ea772a7..9238c72 100644 --- a/src/network/encodable.rs +++ b/src/network/encodable.rs @@ -51,11 +51,11 @@ pub trait ConsensusDecodable, E> { } /// A variable-length unsigned integer -#[deriving(PartialEq, Eq, PartialOrd, Ord, Clone, Show)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Show)] pub struct VarInt(pub u64); /// Data which must be preceded by a 4-byte checksum -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct CheckedData(pub Vec); // Primitive types diff --git a/src/network/message.rs b/src/network/message.rs index 12f63a7..a900675 100644 --- a/src/network/message.rs +++ b/src/network/message.rs @@ -34,7 +34,7 @@ use network::serialize::{serialize, RawDecoder, SimpleEncoder, SimpleDecoder}; use util::misc::prepend_err; /// Serializer for command string -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct CommandString(pub String); impl, E> ConsensusEncodable for CommandString { @@ -72,7 +72,7 @@ pub enum SocketResponse { ConnectionFailed(IoError, Sender<()>) } -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] /// A Network message payload. Proper documentation is available on the Bitcoin /// wiki https://en.bitcoin.it/wiki/Protocol_specification pub enum NetworkMessage { diff --git a/src/network/message_blockdata.rs b/src/network/message_blockdata.rs index c9dbaeb..aeeee9a 100644 --- a/src/network/message_blockdata.rs +++ b/src/network/message_blockdata.rs @@ -23,7 +23,7 @@ use network::encodable::{ConsensusDecodable, ConsensusEncodable}; use network::serialize::{SimpleDecoder, SimpleEncoder}; use util::hash::Sha256dHash; -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] /// The type of an inventory object pub enum InvType { /// Error --- these inventories can be ignored @@ -37,7 +37,7 @@ pub enum InvType { // Some simple messages /// The `getblocks` message -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct GetBlocksMessage { /// The protocol version pub version: u32, @@ -50,7 +50,7 @@ pub struct GetBlocksMessage { } /// The `getheaders` message -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct GetHeadersMessage { /// The protocol version pub version: u32, @@ -63,7 +63,7 @@ pub struct GetHeadersMessage { } /// An inventory object --- a reference to a Bitcoin object -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct Inventory { /// The type of object that is referenced pub inv_type: InvType, diff --git a/src/network/message_network.rs b/src/network/message_network.rs index 5c09374..33b973d 100644 --- a/src/network/message_network.rs +++ b/src/network/message_network.rs @@ -27,7 +27,7 @@ use network::socket::Socket; /// Some simple messages /// The `version` message -#[deriving(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Show)] pub struct VersionMessage { /// The P2P network protocol version pub version: u32, diff --git a/src/network/socket.rs b/src/network/socket.rs index 7a8a1e5..aa1fa15 100644 --- a/src/network/socket.rs +++ b/src/network/socket.rs @@ -49,7 +49,7 @@ fn ipaddr_to_bitcoin_addr(ipaddr: &ip::IpAddr) -> [u8; 16] { } /// A network socket along with information about the peer -#[deriving(Clone)] +#[derive(Clone)] pub struct Socket { /// The underlying socket, which is only used directly to (a) get /// information about the socket, and (b) to close down the socket, diff --git a/src/util/base58.rs b/src/util/base58.rs index 77d2645..97a1cb4 100644 --- a/src/util/base58.rs +++ b/src/util/base58.rs @@ -21,7 +21,7 @@ use util::thinvec::ThinVec; use util::hash::Sha256dHash; /// An error that might occur during base58 decoding -#[deriving(Show, PartialEq, Eq, Clone)] +#[derive(Show, PartialEq, Eq, Clone)] pub enum Base58Error { /// Invalid character encountered BadByte(u8), diff --git a/src/util/error.rs b/src/util/error.rs index 0a6c88f..6e9b12a 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -22,7 +22,7 @@ use std::io::IoError; pub type BitcoinResult = Result; /// A general error code -#[deriving(PartialEq, Eq, Show, Clone)] +#[derive(PartialEq, Eq, Show, Clone)] pub enum BitcoinError { /// An I/O error InputOutput(IoError), diff --git a/src/util/hash.rs b/src/util/hash.rs index 30b4a77..0d44c7a 100644 --- a/src/util/hash.rs +++ b/src/util/hash.rs @@ -50,22 +50,22 @@ impl_array_newtype!(Ripemd160Hash, u8, 20); /// A "hasher" which just truncates and adds data to its state. Should /// only be used for hashtables indexed by "already random" data such /// as SHA2 hashes -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct DumbHasher; /// The state of a `DumbHasher` pub struct DumbHasherState([u8; 8]); /// A 32-bit hash obtained by truncating a real hash -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct Hash32((u8, u8, u8, u8)); /// A 48-bit hash obtained by truncating a real hash -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct Hash48((u8, u8, u8, u8, u8, u8)); /// A 64-bit hash obtained by truncating a real hash -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct Hash64((u8, u8, u8, u8, u8, u8, u8, u8)); diff --git a/src/wallet/address.rs b/src/wallet/address.rs index 7aa15d5..51cbf80 100644 --- a/src/wallet/address.rs +++ b/src/wallet/address.rs @@ -27,7 +27,7 @@ use util::hash::Ripemd160Hash; use util::base58::Base58Error::{self, InvalidLength, InvalidVersion}; use util::base58::{FromBase58, ToBase58}; -#[deriving(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq)] /// A Bitcoin address pub struct Address { /// The network on which this address is usable diff --git a/src/wallet/address_index.rs b/src/wallet/address_index.rs index 2158124..355d358 100644 --- a/src/wallet/address_index.rs +++ b/src/wallet/address_index.rs @@ -33,7 +33,7 @@ use wallet::wallet::Wallet; use util::hash::{DumbHasher, Sha256dHash}; /// The type of a wallet-spendable txout -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub enum WalletTxOutType { /// Pay-to-address transaction redeemable using an ECDSA key PayToAddress(SecretKey), @@ -43,7 +43,7 @@ pub enum WalletTxOutType { /// A txout that is spendable by the wallet -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct WalletTxOut { /// The TXID of the transaction this output is part of pub txid: Sha256dHash, @@ -58,7 +58,7 @@ pub struct WalletTxOut { } /// An address index -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct AddressIndex { tentative_index: HashMap>, index: HashMap<(Sha256dHash, u32), Vec, DumbHasher>, diff --git a/src/wallet/bip32.rs b/src/wallet/bip32.rs index 6daa302..d2508e1 100644 --- a/src/wallet/bip32.rs +++ b/src/wallet/bip32.rs @@ -51,7 +51,7 @@ impl Default for Fingerprint { } /// Extended private key -#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Show)] +#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Show)] pub struct ExtendedPrivKey { /// The network this key is to be used on pub network: Network, @@ -68,7 +68,7 @@ pub struct ExtendedPrivKey { } /// Extended public key -#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Show)] +#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Show)] pub struct ExtendedPubKey { /// The network this key is to be used on pub network: Network, @@ -85,7 +85,7 @@ pub struct ExtendedPubKey { } /// A child number for a derived key -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub enum ChildNumber { /// Hardened key index, within [0, 2^31 - 1] Hardened(u32), @@ -114,7 +114,7 @@ impl, E> Decodable for ChildNumber { } /// A BIP32 error -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub enum Error { /// A pk->pk derivation was attempted on a hardened key CannotDeriveFromHardenedKey, diff --git a/src/wallet/wallet.rs b/src/wallet/wallet.rs index 2d97a8d..f655fae 100644 --- a/src/wallet/wallet.rs +++ b/src/wallet/wallet.rs @@ -31,7 +31,7 @@ use wallet::address::Address; use wallet::address_index::AddressIndex; /// A Wallet error -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub enum Error { /// Tried to lookup an account by name, but none was found AccountNotFound, @@ -54,7 +54,7 @@ pub enum AccountChain { } /// An account -#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Show)] +#[derive(Clone, PartialEq, Eq, Encodable, Decodable, Show)] pub struct Account { name: String, internal_path: Vec, @@ -80,7 +80,7 @@ impl Default for Account { } /// A wallet -#[deriving(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Show)] pub struct Wallet { master: ExtendedPrivKey, accounts: HashMap,