mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-30 20:52:12 +08:00
test: default tenure height for testing
This commit is contained in:
@@ -2555,7 +2555,22 @@ impl NakamotoChainState {
|
|||||||
.connection()
|
.connection()
|
||||||
.as_free_transaction(|clarity_tx_conn| {
|
.as_free_transaction(|clarity_tx_conn| {
|
||||||
clarity_tx_conn.with_clarity_db(|db| {
|
clarity_tx_conn.with_clarity_db(|db| {
|
||||||
let tenure_ht = db.get_tenure_height()?;
|
let tenure_ht = match db.get_tenure_height() {
|
||||||
|
Ok(ht) => ht,
|
||||||
|
Err(e) => {
|
||||||
|
if cfg!(test) {
|
||||||
|
// In test mode, the epoch 3.0 initialization does not always
|
||||||
|
// get called to initialize this tenure height so we ignore
|
||||||
|
// the error here and return a default value.
|
||||||
|
warn!("Failed to get tenure height, defaulting to 0");
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
// If not in test mode, this is definitely an error.
|
||||||
|
return Err(e.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
db.set_tenure_height(
|
db.set_tenure_height(
|
||||||
tenure_ht
|
tenure_ht
|
||||||
.checked_add(1)
|
.checked_add(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user