-
Notifications
You must be signed in to change notification settings - Fork 370
Check validity rules on tip-sel and check-consistency only #1802
Check validity rules on tip-sel and check-consistency only #1802
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Just I'm not so clear about when you decide to enforce the extra rules and when you don't.
Travis is not so happy btw.
@@ -133,7 +133,7 @@ public boolean isBalanceDiffConsistent(Set<Hash> approvedHashes, Map<Hash, Long> | |||
} | |||
Set<Hash> visitedHashes = new HashSet<>(approvedHashes); | |||
Map<Hash, Long> currentState = generateBalanceDiff(visitedHashes, tip, | |||
snapshotProvider.getLatestSnapshot().getIndex()); | |||
snapshotProvider.getLatestSnapshot().getIndex(), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forcing extra rules here cannot break backward compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please verify that when we apply milestone we don't hit this code
Only in tip-selection we do
@acha-bill 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);
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
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
true
, on a bundle that will otherwise be valid.false
we verify that the extra checks are not being calledChecklist: