Skip to content

[Fix] application of fee for collateralized conversion could be ineffective

Andrzej Lisak requested to merge abw_narrow_price_fee_fix into develop

When price was defined narrowly - with satoshi rather than full HBD/HIVE (f.e. as 0.001 HBD / 0.004 HIVE) - fee for collateralized conversion was truncated out and effectively not applied. Instead of applying fee to price, the fix applies fee when asset is multiplied by price. Added two tests: for price defined narrowly (to detect truncations that are now fixed) and for price defined very widely (to detect problem of overflow that would occur if the fix used more obvious but wrong route).

Also changed regular price multiplication slightly so exception is cast by regular FC_ASSERT (where we have extra debug code) instead of raw cast.

Merge request reports