Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

public class VerkleAccount extends DiffBasedAccount {
private Hash storageRoot; // TODO REMOVE AS USELESS
private int hashCode;
Comment on lines 39 to +40
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we remove storageRoot while we are here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good shout. @matkt mentioned he will remove it in future PR so I didn't want to create conflicts unnecessarily


public VerkleAccount(
final DiffBasedWorldView context,
Expand Down Expand Up @@ -180,4 +181,33 @@ public static void assertCloseEnoughForDiffing(
public boolean isStorageEmpty() {
return true; // TODO need to find a way to manage that with verkle
}

@Override
public boolean equals(final Object other) {
if (this == other) {
return true;
} else if (!(other instanceof VerkleAccount)) {
return false;
}
VerkleAccount otherVerkleAccount = (VerkleAccount) other;
return Objects.equals(this.address, otherVerkleAccount.address)
&& this.nonce == otherVerkleAccount.nonce
&& Objects.equals(this.balance, otherVerkleAccount.balance)
&& Objects.equals(this.codeHash, otherVerkleAccount.codeHash);
}

@Override
public int hashCode() {
if (!immutable) {
return computeHashCode();
}
if (hashCode == 0) {
hashCode = computeHashCode();
}
return hashCode;
}

private int computeHashCode() {
return Objects.hash(address, nonce, balance, codeHash);
}
}
Loading