Skip to content
Permalink
Browse files

fix transaction

  • Loading branch information...
NicolasDP committed Mar 12, 2019
1 parent ed75280 commit ce278e0e9f03cd81fb9cec7131fae99b31e41e1e
Showing with 0 additions and 19 deletions.
  1. +0 −19 chain-impl-mockchain/src/transaction/mod.rs
@@ -151,24 +151,13 @@ where
type Output = Output<OutAddress>;
type Inputs = [Self::Input];
type Outputs = [Self::Output];
type Id = TransactionId;

fn inputs(&self) -> &Self::Inputs {
&self.inputs
}
fn outputs(&self) -> &Self::Outputs {
&self.outputs
}
fn id(&self) -> Self::Id {
use chain_core::property::Serialize;

// TODO: we should be able to avoid to serialise the whole transaction
// in memory, using a hasher.
let bytes = self
.serialize_as_vec()
.expect("In memory serialization is expected to work");
Hash::hash_bytes(&bytes)
}
}

impl<OutAddress> property::Transaction for SignedTransaction<OutAddress>
@@ -180,17 +169,13 @@ where
type Output = <Transaction<OutAddress> as property::Transaction>::Output;
type Inputs = <Transaction<OutAddress> as property::Transaction>::Inputs;
type Outputs = <Transaction<OutAddress> as property::Transaction>::Outputs;
type Id = <Transaction<OutAddress> as property::Transaction>::Id;

fn inputs(&self) -> &Self::Inputs {
self.transaction.inputs()
}
fn outputs(&self) -> &Self::Outputs {
self.transaction.outputs()
}
fn id(&self) -> Self::Id {
self.transaction.id()
}
}

#[cfg(test)]
@@ -199,10 +184,6 @@ mod test {
use quickcheck::{Arbitrary, Gen, TestResult};

quickcheck! {
fn transaction_id_is_unique(tx1: Transaction<Address>, tx2: Transaction<Address>) -> bool {
chain_core::property::testing::transaction_id_is_unique(tx1, tx2)
}

fn transaction_encode_decode(transaction: Transaction<Address>) -> TestResult {
chain_core::property::testing::serialization_bijection(transaction)
}

0 comments on commit ce278e0

Please sign in to comment.
You can’t perform that action at this time.