-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Correct log index in transaction receipt #3995
Conversation
@@ -1535,6 +1499,52 @@ impl Drop for Client { | |||
} | |||
} | |||
|
|||
fn transaction_receipt(transaction: Option<LocalizedTransaction>, receipts: Option<Vec<Receipt>>) -> Option<LocalizedReceipt> { | |||
let tx_and_sender = transaction | |||
.and_then(|tx| tx.sender().ok().map(|sender| (tx, sender))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having this check within the body (and corresponding match for the output) is a bit weird.
fn transaction_receipt(LocalizedTransaction, Address, Vec<Receipt>) -> LocalizedReceipt
seems like a cleaner interface.
a comment explaining what it does would be nice too. although it seems to me that actually you just need a fn(Transaction, Address, Receipt, usize)
to do the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not really needed at all, but it is very difficult to test Client::transaction_receipt
so I wanted to move as much logic as possible here to be able to test it properly.
Also most of the options could be replaced with .expect("Blockchain database is never pruned and stays consistent.")
but I think current approach with .and_then
chain is more future proof.
I will move Options
to Client::transaction_receipt
* Moving logs to separate, testable function * Adding test * Fixing log index * Adding transaction log index * Fixing rpc tests * Making interface of a bit cleaner. Conflicts: ethcore/src/client/client.rs ethcore/src/tests/client.rs ethcore/src/types/transaction.rs
* Fix up the transaction JSON serialisation for RPC. * Introduce to_hex() utility in bigint. Fix tests. Conflicts: rpc/src/v1/tests/mocked/eth.rs rpc/src/v1/tests/mocked/signing.rs rpc/src/v1/types/block.rs rpc/src/v1/types/transaction.rs * fix comment * Fix build. * Bump hyper * Correct log index in transaction receipt (#3995) * Moving logs to separate, testable function * Adding test * Fixing log index * Adding transaction log index * Fixing rpc tests * Making interface of a bit cleaner. Conflicts: ethcore/src/client/client.rs ethcore/src/tests/client.rs ethcore/src/types/transaction.rs * Encode networkid as a u64. Conflicts: ethcore/src/types/transaction.rs * Fixing compilation issues * parse testnet chain as ropsten * Removing unused import
Fixes
log_index
to meanlog index in block
consistently.Introduces
transaction_log_index
.Closes #3601, #2075, #3537