Improve canonicalization of serialized amounts:

The existing code that deserialized an STAmount was sub-optimal and performed
poorly. In some rare cases the operation could result in otherwise valid
serialized amounts overflowing during deserialization. This commit will help
detect error conditions more quickly and eliminate the problematic corner cases.
This commit is contained in:
seelabs
2020-12-01 13:58:36 -05:00
committed by manojsdoshi
parent fe129e8e4f
commit c47b4f3667
7 changed files with 63 additions and 3 deletions

View File

@@ -134,6 +134,7 @@ detail::supportedAmendments()
//"NegativeUNL", // Commented out to prevent automatic enablement
"TicketBatch",
"FlowSortStrands",
"fixSTAmountCanonicalize",
};
return supported;
}
@@ -188,7 +189,8 @@ uint256 const
fixAmendmentMajorityCalc = *getRegisteredFeature("fixAmendmentMajorityCalc"),
featureNegativeUNL = *getRegisteredFeature("NegativeUNL"),
featureTicketBatch = *getRegisteredFeature("TicketBatch"),
featureFlowSortStrands = *getRegisteredFeature("FlowSortStrands");
featureFlowSortStrands = *getRegisteredFeature("FlowSortStrands"),
fixSTAmountCanonicalize = *getRegisteredFeature("fixSTAmountCanonicalize");
// The following amendments have been active for at least two years. Their
// pre-amendment code has been removed and the identifiers are deprecated.