Skip to content

Commit 7af0a11

Browse files
committed
hotfix: load the BurnStateDB implementation from the block's header's consensus_hash field, not the canonical tip
1 parent 40059a5 commit 7af0a11

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

stackslib/src/net/api/postblock_proposal.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,17 @@ impl NakamotoBlockProposal {
363363
});
364364
}
365365

366-
let sort_tip = SortitionDB::get_canonical_sortition_tip(sortdb.conn())?;
367-
let burn_dbconn: SortitionHandleConn = sortdb.index_handle(&sort_tip);
368-
let mut db_handle = sortdb.index_handle(&sort_tip);
366+
let sort_tip = SortitionDB::get_block_snapshot_consensus(
367+
sortdb.conn(),
368+
&self.block.header.consensus_hash,
369+
)?
370+
.ok_or_else(|| BlockValidateRejectReason {
371+
reason_code: ValidateRejectCode::NoSuchTenure,
372+
reason: "Failed to find sortition for block tenure".to_string(),
373+
})?;
374+
375+
let burn_dbconn: SortitionHandleConn = sortdb.index_handle(&sort_tip.sortition_id);
376+
let mut db_handle = sortdb.index_handle(&sort_tip.sortition_id);
369377

370378
// (For the signer)
371379
// Verify that the block's tenure is on the canonical sortition history

0 commit comments

Comments
 (0)