From 443eb19739b678c1d4d1a944083de17157b08e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Fri, 30 Sep 2016 11:14:30 +0200 Subject: [PATCH] Fixing logs-receipt matching (#2403) --- ethcore/src/blockchain/blockchain.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index f743e8743..8daf672b9 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -331,11 +331,12 @@ impl BlockProvider for BlockChain { .filter_map(|number| self.block_hash(number).map(|hash| (number, hash))) .filter_map(|(number, hash)| self.block_receipts(&hash).map(|r| (number, hash, r.receipts))) .filter_map(|(number, hash, receipts)| self.block_body(&hash).map(|ref b| (number, hash, receipts, BodyView::new(b).transaction_hashes()))) - .flat_map(|(number, hash, mut receipts, hashes)| { + .flat_map(|(number, hash, mut receipts, mut hashes)| { assert_eq!(receipts.len(), hashes.len()); log_index = receipts.iter().fold(0, |sum, receipt| sum + receipt.logs.len()); let receipts_len = receipts.len(); + hashes.reverse(); receipts.reverse(); receipts.into_iter() .map(|receipt| receipt.logs) @@ -1760,7 +1761,7 @@ mod tests { gas_price: 0.into(), gas: 100_000.into(), action: Action::Create, - value: 100.into(), + value: 101.into(), data: "601080600c6000396000f3006000355415600957005b60203560003555".from_hex().unwrap(), }.sign(&"".sha3()); let t2 = Transaction { @@ -1768,7 +1769,7 @@ mod tests { gas_price: 0.into(), gas: 100_000.into(), action: Action::Create, - value: 100.into(), + value: 102.into(), data: "601080600c6000396000f3006000355415600957005b60203560003555".from_hex().unwrap(), }.sign(&"".sha3()); let t3 = Transaction { @@ -1776,7 +1777,7 @@ mod tests { gas_price: 0.into(), gas: 100_000.into(), action: Action::Create, - value: 100.into(), + value: 103.into(), data: "601080600c6000396000f3006000355415600957005b60203560003555".from_hex().unwrap(), }.sign(&"".sha3()); let tx_hash1 = t1.hash();