Skip to content

Commit

Permalink
Use tie for comparator
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar authored and prasannavl committed Mar 18, 2022
1 parent 6345276 commit be46f8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/masternodes/govvariables/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
10 changes: 10 additions & 0 deletions test/functional/feature_poolswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, [])
Expand Down Expand Up @@ -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...")
Expand Down

0 comments on commit be46f8a

Please sign in to comment.