Skip to content

Commit

Permalink
chain: No-op when supplementing v1 blocks post-hardfork
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed Feb 17, 2024
1 parent 49a5d88 commit ca6ce92
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions chain/db.go
Expand Up @@ -526,8 +526,12 @@ func (db *DBStore) BestIndex(height uint64) (index types.ChainIndex, ok bool) {

// SupplementTipTransaction implements Store.
func (db *DBStore) SupplementTipTransaction(txn types.Transaction) (ts consensus.V1TransactionSupplement) {
height := db.getHeight()
if height >= db.n.HardforkV2.RequireHeight {
return consensus.V1TransactionSupplement{}
}
// get tip state, for proof-trimming
index, _ := db.BestIndex(db.getHeight())
index, _ := db.BestIndex(height)
cs, _ := db.State(index.ID)
numLeaves := cs.Elements.NumLeaves

Expand Down Expand Up @@ -559,8 +563,13 @@ func (db *DBStore) SupplementTipTransaction(txn types.Transaction) (ts consensus

// SupplementTipBlock implements Store.
func (db *DBStore) SupplementTipBlock(b types.Block) (bs consensus.V1BlockSupplement) {
height := db.getHeight()
if height >= db.n.HardforkV2.RequireHeight {
return consensus.V1BlockSupplement{Transactions: make([]consensus.V1TransactionSupplement, len(b.Transactions))}
}

// get tip state, for proof-trimming
index, _ := db.BestIndex(db.getHeight())
index, _ := db.BestIndex(height)
cs, _ := db.State(index.ID)
numLeaves := cs.Elements.NumLeaves

Expand Down

0 comments on commit ca6ce92

Please sign in to comment.