blockchain transaction api

This commit is contained in:
debris
2016-02-08 15:53:22 +01:00
parent 038f80437e
commit 483ee1fbce
4 changed files with 57 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ use util::*;
use error::*;
use evm::Schedule;
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
/// Transaction action type.
pub enum Action {
/// Create creates new contract.
@@ -45,7 +45,7 @@ impl Decodable for Action {
/// A set of information describing an externally-originating message call
/// or contract creation operation.
#[derive(Default, Debug, Clone)]
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct Transaction {
/// Nonce.
pub nonce: U256,
@@ -158,7 +158,7 @@ impl Transaction {
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq)]
pub struct SignedTransaction {
/// Plain Transaction.
unsigned: Transaction,
@@ -174,6 +174,12 @@ pub struct SignedTransaction {
sender: RefCell<Option<Address>>
}
impl PartialEq for SignedTransaction {
fn eq(&self, other: &SignedTransaction) -> bool {
self.unsigned == other.unsigned && self.v == other.v && self.r == other.r && self.s == other.s
}
}
impl Deref for SignedTransaction {
type Target = Transaction;