Closed Solomon1732 closed 3 years ago
Good find, go ahead 👍
Ah, wait, I think I totally misread the code.
if self.order.is_ask():
if tup1[1] < tup2[1]:
return 1
else:
return -1
else:
if tup1[1] < tup2[1]:
return -1
else:
return 1
When looked at in isolation the returned value is -1 if the order is an ask
and 1 if not. Basically the results returned are flipped, depending on whether order
is an ask
or not. Uniting the two cases would break behavior.
My apologies for missing it and opening a frivolous issue. I totally missed the difference when reading it!
No problem! IIRC, the match queue was made quite close to the conference deadline, so I was a bit in a rush writing it. This did also not result in the most readable code 😁
In the sub-function there is an
if
statement in thecmp_items
internal function. Thatif
statement checksself.order.is_ask()
. However both theif
and theelse
branch have the same code.https://github.com/Tribler/anydex-core/blob/9d11982332f257e1a94e4aca838e4685bd084707/anydex/core/match_queue.py#L27
Edit: since it seems like it would be a minor issue to solve, I don't mind adding the solution to #67