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

Fix manager panic #23

Merged
merged 3 commits into from Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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