parent
399dfc4c2e
commit
828bf7cb9e
@ -580,14 +580,21 @@ impl<V> BlockChainClient for Client<V> where V: Verifier {
|
||||
let block_number = tx.block_number.clone();
|
||||
let transaction_hash = tx.hash();
|
||||
let transaction_index = tx.transaction_index;
|
||||
let prior_gas_used = match tx.transaction_index {
|
||||
0 => U256::zero(),
|
||||
i => {
|
||||
let prior_address = TransactionAddress { block_hash: address.block_hash, index: i - 1 };
|
||||
let prior_receipt = self.chain.transaction_receipt(&prior_address).expect("Transaction receipt at `address` exists; `prior_address` has lower index in same block; qed");
|
||||
prior_receipt.gas_used
|
||||
}
|
||||
};
|
||||
Some(LocalizedReceipt {
|
||||
transaction_hash: tx.hash(),
|
||||
transaction_index: tx.transaction_index,
|
||||
block_hash: tx.block_hash,
|
||||
block_number: tx.block_number,
|
||||
// TODO: to fix this, query all previous transaction receipts and retrieve their gas usage
|
||||
cumulative_gas_used: receipt.gas_used,
|
||||
gas_used: receipt.gas_used,
|
||||
gas_used: receipt.gas_used - prior_gas_used,
|
||||
contract_address: match tx.action {
|
||||
Action::Call(_) => None,
|
||||
Action::Create => Some(contract_address(&tx.sender().unwrap(), &tx.nonce))
|
||||
|
@ -91,9 +91,9 @@ pub struct LocalizedReceipt {
|
||||
pub block_hash: H256,
|
||||
/// Block number.
|
||||
pub block_number: BlockNumber,
|
||||
/// Cumulative gas used.
|
||||
/// The total gas used in the block following execution of the transaction.
|
||||
pub cumulative_gas_used: U256,
|
||||
/// Gas used.
|
||||
/// The gas used in the execution of the transaction. Note the difference of meaning to `Receipt::gas_used`.
|
||||
pub gas_used: U256,
|
||||
/// Contract address.
|
||||
pub contract_address: Option<Address>,
|
||||
|
@ -117,10 +117,10 @@ Sealing/Mining Options:
|
||||
|
||||
Footprint Options:
|
||||
--tracing BOOL Indicates if full transaction tracing should be
|
||||
enabled. Works only if client had been fully synced with
|
||||
tracing enabled. BOOL may be one of auto, on, off.
|
||||
auto uses last used value of this option (off if it does
|
||||
not exist) [default: auto].
|
||||
enabled. Works only if client had been fully synced
|
||||
with tracing enabled. BOOL may be one of auto, on,
|
||||
off. auto uses last used value of this option (off
|
||||
if it does not exist) [default: auto].
|
||||
--pruning METHOD Configure pruning of the state/storage trie. METHOD
|
||||
may be one of auto, archive, fast, basic, light:
|
||||
archive - keep all state trie data. No pruning.
|
||||
|
Loading…
Reference in New Issue
Block a user