iotaledger / iri

IOTA Reference Implementation
Other
1.15k stars 370 forks source link

Check validity rules on tip-sel and check-consistency only #1802

Closed GalRogozinski closed 4 years ago

GalRogozinski commented 4 years ago

Description

We want the rules added in #1786 to only be used when we are doing tip-selection and check consistency calls. This is so that IRI won't give an error when calculating the ledger state on old milestones that didn't adhere to the rule.

We have a boolean flag in the validate method that takes care of the 2 modes, that forces the extra checks.

Fixes #1746

Type of change

How Has This Been Tested?

Unit test have been added

Checklist:

GalRogozinski commented 4 years ago

@acha-bill Taking a discussion from slack here about the behavior of GetBalances.

I think this doesn't hurt previously confirmed txs because the snapshot is being inspected directly here:

 for (final Hash address : addressList) {
                Long value = snapshotProvider.getLatestSnapshot().getBalance(address);
                if (value == null) {
                    value = 0L;
                }
                balances.put(address, value);
            }