Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chris124567 committed Jun 17, 2024
1 parent bd5000e commit f05cea8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions persist/sqlite/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,14 +812,25 @@ func updateFileContractElements(tx *txn, revert bool, b types.Block, fces []expl
var fce *types.FileContractElement

if revert {
// Reverting
if update.Revision != nil {
// Contract revision reverted.
// We are reverting the revision, so get the contract before
// the revision.
fce = &update.FileContractElement
} else {
// Contract formation reverted.
// The contract update has no revision, therefore it refers
// to the original contract formation.
continue
}
} else {
// Applying
fce = &update.FileContractElement
if update.Revision != nil {
// Contract is revised.
// We want last_contract_revision to refer to the latest
// revision, so use the revision FCE if there is one.
fce = update.Revision
}
}
Expand Down

0 comments on commit f05cea8

Please sign in to comment.