From 46ad40be4ca6bccc7e7a4e701b43635ae4660db1 Mon Sep 17 00:00:00 2001 From: "Jieyi Long (THETA Network)" Date: Tue, 21 Mar 2023 21:28:23 +0800 Subject: [PATCH] Fixes --- ledger/ledger.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ledger/ledger.go b/ledger/ledger.go index 466c608..5ef63f6 100644 --- a/ledger/ledger.go +++ b/ledger/ledger.go @@ -673,13 +673,16 @@ func (ledger *Ledger) getNewDynastyAndValidatorSet(view *slst.StoreView) (enteri } registrationDynasty := scom.CalculateDynasty(registrationMainchainHeight) - if currentDynasty.Cmp(registrationDynasty) == 0 { + witnessedDynasty := scom.CalculateDynasty(mainchainBlockHeight) + + logger.Debugf("currentDynasty: %v, witnessedDynasty: %v, egistrationDynasty: %v, registrationMainchainHeight: %v", currentDynasty, witnessedDynasty, registrationDynasty, registrationMainchainHeight) + + if witnessedDynasty.Cmp(registrationDynasty) == 0 { // For the initial dynasty, i.e. the dynasty during which the subchain was registered, instead of querying // the validator set from the main chain, we trust the validator set in the snapshot return false, nil, nil } - witnessedDynasty := scom.CalculateDynasty(mainchainBlockHeight) witnessedValidatorSet, err := ledger.metachainWitness.GetValidatorSetByDynasty(witnessedDynasty) if err != nil { logger.Warnf("Failed to get validator set by dynasty %v when checking validator set updates, err: %v", witnessedDynasty, err)