[qa] smartfees: Properly use ordered dict#7980
Conversation
|
@MarcoFalke Marko, do you have a sample of how it fails without this change? I did 100 runs of master to compare and ACK this and it was always OK... |
|
@paveljanik This depends on your environment. I will post exact steps to reproduce tonight, when I am home. |
|
+1 for using OrderedDict. Normal dicts's order is randomized (they use a random seed for security reasons) and it's clear that the order of those outputs here matters. Aside: as of Python 3.5 OrderedDict is implemented in C and hence almost as fast as normal dict. Not that it matters in this particular instance. |
|
To reproduce I'd suggest using an OrderedDict with the items reversed. (can't do it myself right now, running the extended test suite using python 3) This PR is also part of #7814. |
|
@paveljanik To test this you can use E.g. |
|
Still not able to reproduce here on master, OS X. On the other hand, this command now failed for me on OS X, with this PR: Edit: Python is Python 2.7 on this test machine. |
|
When I run the test as Using your method (with or without |
facc8fb to
fa17f93
Compare
|
@paveljanik Thanks for noticing! Of course I need to fix it in the other places as well... |
|
Tests are running. @MarcoFalke Feel free to cherrypick typos from bcdd81c |
9289f49 to
43bbcd0
Compare
|
@paveljanik Done, thx. |
|
20 runs of ACK 43bbcd0 |
Github-Pull: bitcoin#7980 Rebased-From: fa17f93 43bbcd0
Dictionaries are not guaranteed to be sorted; Use an
OrderedDictto avoid random failures of the smartfees test.