diff --git a/ncli/ncli_db.nim b/ncli/ncli_db.nim index beb38d8c5..59ef5ef43 100644 --- a/ncli/ncli_db.nim +++ b/ncli/ncli_db.nim @@ -523,9 +523,13 @@ proc cmdValidatorPerf(conf: DbConf, cfg: RuntimeConfig) = for bi in 0.. 0: start - 1 else: 0.Slot), false, cache) + var inTxn = false proc processEpoch() = echo getStateField(state[].data, slot).epoch - outDb.exec("BEGIN TRANSACTION;").expect("DB") + if not inTxn: + outDb.exec("BEGIN TRANSACTION;").expect("DB") + inTxn = true insertEpochInfo.exec( (getStateField(state[].data, slot).epoch.int64, rewards.total_balances.current_epoch_raw.int64, @@ -746,14 +753,20 @@ proc cmdValidatorDb(conf: DbConf, cfg: RuntimeConfig) = int64(target_attester), # Target delta int64(head_attester), # Head delta delay)).expect("DB") - outDb.exec("COMMIT;").expect("DB") + if getStateField(state[].data, slot).epoch.int64 mod 16 == 0: + inTxn = false + outDb.exec("COMMIT;").expect("DB") for bi in 0..