From be46f8ada5682cde5262ab5be4989e0fff0dff9a Mon Sep 17 00:00:00 2001 From: Peter Bushnell Date: Fri, 4 Feb 2022 07:38:32 +0000 Subject: [PATCH] Use tie for comparator --- src/masternodes/govvariables/attributes.h | 4 +--- test/functional/feature_poolswap.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/masternodes/govvariables/attributes.h b/src/masternodes/govvariables/attributes.h index 4e9c5c1112..bb97f1edc9 100644 --- a/src/masternodes/govvariables/attributes.h +++ b/src/masternodes/govvariables/attributes.h @@ -60,9 +60,7 @@ struct CDataStructureV0 { } bool operator<(const CDataStructureV0& o) const { - return type < o.type - || (type == o.type - && key < o.key); + return std::tie(type, typeId, key) < std::tie(o.type, o.typeId, o.key); } }; diff --git a/test/functional/feature_poolswap.py b/test/functional/feature_poolswap.py index ae67809560..89b1612ef7 100755 --- a/test/functional/feature_poolswap.py +++ b/test/functional/feature_poolswap.py @@ -354,6 +354,8 @@ def run_test(self): }, []) self.nodes[0].generate(1) + idBL = list(self.nodes[0].gettoken("BTC-LTC").keys())[0] + self.nodes[0].addpoolliquidity({ accountGN0: ["1@" + symbolBTC, "100@" + symbolLTC] }, accountGN0, []) @@ -482,6 +484,14 @@ def run_test(self): pool = self.nodes[0].getpoolpair("GS")[idGS] assert_equal(reserveA, pool['reserveA']) + self.nodes[0].setgov({"ATTRIBUTES":{'v0/poolpairs/%s/token_a_fee_pct'%(idBL): '0.01', 'v0/poolpairs/%s/token_b_fee_pct'%(idBL): '0.01'}}) + self.nodes[0].generate(1) + + print(self.nodes[0].getblockcount()) + print(self.nodes[0].getgov('ATTRIBUTES')['ATTRIBUTES']) + + assert_equal(self.nodes[0].getgov('ATTRIBUTES')['ATTRIBUTES'], {'v0/poolpairs/%s/token_a_fee_pct'%(idGS): '0.01', 'v0/poolpairs/%s/token_b_fee_pct'%(idGS): '0.01', 'v0/poolpairs/%s/token_a_fee_pct'%(idBL): '0.01', 'v0/poolpairs/%s/token_b_fee_pct'%(idBL): '0.01'}) + # REVERTING: #======================== print ("Reverting...")