iotaledger / hornet

HORNET is a powerful IOTA fullnode software
Apache License 2.0
312 stars 153 forks source link

db-verifiy compareLedgerState uses wrong state for comparison #1844

Closed shufps closed 1 year ago

shufps commented 1 year ago

Here: https://github.com/iotaledger/hornet/blob/v1.2.4/pkg/toolset/database_verify.go#L380

func compareLedgerState(utxoManagerSource *utxo.Manager, utxoManagerTemp *utxo.Manager) error {

    ledgerStateSource, err := utxoManagerSource.LedgerStateSHA256Sum()
    if err != nil {
        return err
    }
    ledgerStateTemp, err := utxoManagerSource.LedgerStateSHA256Sum()
    if err != nil {
        return err
    }
    if !bytes.Equal(ledgerStateSource, ledgerStateTemp) {
        return errors.New("ledger state of source database and temp database does not match")
    }

    return nil
}

The function uses two times utxoManagerSource for comparison.

muXxer commented 1 year ago

fixed in 1.2.6