Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Add RPC & client call to replay a transaction. #1734

Merged
merged 2 commits into from
Jul 27, 2016
Merged

Conversation

gavofyork
Copy link
Contributor

No description provided.

@gavofyork gavofyork added the A0-pleasereview 🤓 Pull request needs code review. label Jul 26, 2016
@coveralls
Copy link

coveralls commented Jul 26, 2016

Coverage Status

Coverage decreased (-0.06%) to 86.968% when pulling 399a274 on replay-transaction into a9ae6e3 on master.

@@ -660,6 +672,51 @@ impl BlockChainClient for Client {
ret
}

fn replay(&self, id: TransactionID, analytics: CallAnalytics) -> Result<Executed, ReplayError> {
if let Some(address) = self.transaction_address(id) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this:

let address = try!(self.transaction_address(id).ok_or(ReplayError::TransactionNotFound));
let block_data = try!(self.block(BlockID::Hash(address.block_hash)).ok_or(ReplayError::StatePruned));
let mut state = try!(self.state_at_beginning(BlockID::Hash(address.block_hash).ok_or(ReplayError::StatePruned));

let block = ...

if address.index >= txs.len() {
  return Err(ReplayError::TransactionNotFound);
}
...

to avoid nesting?

@tomusdrw tomusdrw added A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jul 27, 2016
@gavofyork gavofyork added A0-pleasereview 🤓 Pull request needs code review. and removed A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Jul 27, 2016
@tomusdrw tomusdrw added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jul 27, 2016
@coveralls
Copy link

coveralls commented Jul 27, 2016

Coverage Status

Coverage decreased (-0.3%) to 86.767% when pulling 7128dac on replay-transaction into a9ae6e3 on master.

@gavofyork gavofyork merged commit eaa41ea into master Jul 27, 2016
@gavofyork gavofyork deleted the replay-transaction branch July 27, 2016 19:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants