Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tie for comparator #1149

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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