Skip to content

Commit

Permalink
cleanup 2
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Apr 2, 2024
1 parent 0679190 commit 97d8479
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions yarn-project/circuit-types/src/l2_block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Body, TxHash } from '@aztec/circuit-types';
import { Body } from '@aztec/circuit-types';
import { AppendOnlyTreeSnapshot, Header, STRING_ENCODING } from '@aztec/circuits.js';
import { sha256, sha256ToField } from '@aztec/foundation/crypto';
import { Fr } from '@aztec/foundation/fields';
Expand Down Expand Up @@ -197,18 +197,6 @@ export class L2Block {
return sha256(inputValue);
}

/**
* A lightweight method to get the tx hash of a tx in the block.
* @param txIndex - the index of the tx in the block
* @returns a hash of the tx, which is the first nullifier in the tx
*/
getTxHash(txIndex: number): TxHash {
// Gets the first nullifier of the tx specified by txIndex
const firstNullifier = this.body.txEffects[txIndex].nullifiers[0];

return new TxHash(firstNullifier.toBuffer());
}

/**
* Returns stats used for logging.
* @returns Stats on tx count, number, and log size and count.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/circuit-types/src/l2_block_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class L2BlockContext {
* @returns The tx's hash.
*/
public getTxHash(txIndex: number): TxHash {
return this.txHashes ? this.txHashes[txIndex] : this.block.getTxHash(txIndex);
return this.txHashes ? this.txHashes[txIndex] : this.block.body.txEffects[txIndex].txHash;
}

/**
Expand Down

0 comments on commit 97d8479

Please sign in to comment.