Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consensus: Mark attestation elements as created #190

Merged
merged 1 commit into from
Aug 14, 2024
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
5 changes: 4 additions & 1 deletion consensus/merkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,10 @@ func updateLeaves(leaves []elementLeaf) [64][]elementLeaf {
var recompute func(i, j uint64, leaves []elementLeaf) types.Hash256
recompute = func(i, j uint64, leaves []elementLeaf) types.Hash256 {
height := bits.TrailingZeros64(j - i) // equivalent to log2(j-i), as j-i is always a power of two
if len(leaves) == 1 && height == 0 {
if height == 0 {
if len(leaves) > 1 {
panic("consensus: multiple leaves with same accumulator index")
}
return leaves[0].hash()
}
mid := (i + j) / 2
Expand Down
1 change: 1 addition & 0 deletions consensus/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ func (ms *MidState) resolveV2FileContractElement(fce types.V2FileContractElement

func (ms *MidState) addAttestationElement(ae types.AttestationElement) {
ms.aes = append(ms.aes, ae)
ms.created[ms.aes[len(ms.aes)-1].ID] = len(ms.aes) - 1
}

// ApplyTransaction applies a transaction to the MidState.
Expand Down
Loading