[bisq-network/bisq-core] Small improvements in DAO code (#176)

sqrrm notifications at github.com
Tue Sep 4 17:18:00 UTC 2018


sqrrm approved this pull request.

utACK

>  
-        double rel = MathUtils.roundDouble((double) age / (double) maxAge, 10);
-        double factor = 1d - rel;
-        long weightedAmount = MathUtils.roundDoubleToLong(amount * factor);
-        log.debug("getWeightedMeritAmount: amount={}, factor={}, weightedAmount={}, ", amount, factor, weightedAmount);
+        // We want a resolution of 1 block so we use the inverseAge and divide by maxAge afterwards to get the
+        // weighted amount
+        // We need to multiply first before we divide!
+        long weightedAmount = (amount * inverseAge) / maxAge;

I like this better than the previous calculations. Much easier to follow for the same effect.

> @@ -569,10 +572,14 @@ private void applyParamChange(Set<EvaluatedProposal> acceptedEvaluatedProposals,
             if (list.size() == 1) {
                 applyAcceptedChangeParamProposal((ChangeParamProposal) list.get(0).getProposal(), chainHeight);
             } else if (list.size() > 1) {
+                log.warn("There have been multiple winning param change proposals with the same item. " +
+                        "This is a sign of a social consensus failure. " +
+                        "We treat all requests as failed in such a case.");

I think this is correct, with a social failure it's unsafe to continue. I don't think this is an attack vector since it needs more than 50% of votes attacking, which is already a bigger issue in itself.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq-core/pull/176#pullrequestreview-152166687
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20180904/e4e7a8a2/attachment.html>


More information about the bisq-github mailing list