From 730d0d6f2f5592a5942d6aa1ed3c0f279b079756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 29 Sep 2016 15:11:57 +0200 Subject: [PATCH] Fixing logs-receipt matching --- 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 f8902532e79..b52704886ba 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) @@ -1761,7 +1762,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 { @@ -1769,7 +1770,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 { @@ -1777,7 +1778,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();