Closed dexX7 closed 9 years ago
Thanks DexX, not sure what's going on here - great testing :)
It probably comes from mastercore::send_INTERNAL_1packet
and it looks like as if the user's balance would be used for a check like this:
The "cancel" seems to be treated as "send", thus a check against the balance. What makes me wonder a bit: "cancel-pair" and "cancel-everything" is explicitly excluded as it seems, but a "cancel-at-price" not. (mastercore.cpp#L2908)
Good catch Dexx, I think this was due to an erroneous assumption on my part (that the user actually needed to check if they had the funds for any cancel - which is not needed)
Added cancel-price to exclusions list, and renamed variables: https://github.com/mastercoin-MSC/mastercore/pull/221/files
@faizkhan00: I'm testing the current master and it seems the test still fails, but based on some other effect:
The cancel itself seems to have no effect anymore.
This is limited to the special case where "amount-to-cancel" > "available-balance" and the other tests of cancel-at-price finish as expected.
1) A1 starts with 50.0 TMSC, 0 TIndiv1:
Orderbook: empty Balance: 50.0 TMSC available, 0.0 TMSC reserved
2) A1 offers 26.0 TMSC for 100 TIndiv1
Orderbook: 26.0 TMSC offered for 100 TIndiv1 Balance: 24.0 TMSC available, 26.0 TMSC reserved
3) A1 cancels 26.0 TMSC for 100 TIndiv1 (cancel-at-price):
Orderbook: 26.0 TMSC offered for 100 TIndiv1 Balance: 24.0 TMSC available, 26.0 TMSC reserved
This was fixed by #221 and #222.
1) A1 starts with 50.0 TMSC, 0 TIndiv1 2) A1 offers 50.0 TMSC for 100 TIndiv1 3) A1 cancels 50.0 TMSC for 100 TIndiv1 (cancel-at-price)
This fails with the message "Not enough funds in user address".
Related test lines: test_cancel_at_price.py#L307-L356