BlockPo / BlockPo-to-Tradelayer

Incubation Repo for the TradeLayer protocol, 0.2.0
http://www.tradelayer.org
Other
8 stars 8 forks source link

False Negatives from rule invalidating Instant Contract Trades #490

Open patrickdugan opened 1 year ago

patrickdugan commented 1 year ago

I believe the if logic is not calculating the expiration properly, obviously I don't want to comment it out because it breaks the game theory of everything in the channel system lol, so maybe I could do so for testing purposes but uncomment this when you have a tweak for us.

if (block > sp.init_block + static_cast(sp.blocks_until_expiration) || block < sp.init_block) { const int& initblock = sp.init_block; const int deadline = initblock + static_cast(sp.blocks_until_expiration); PrintToLog("\nTrade out of deadline!!: actual block: %d, deadline: %d\n", initblock, deadline); return (PKT_ERROR_CHANNELS -16); }

https://github.com/BlockPo/BlockPo-to-Tradelayer/edit/master/src/tradelayer/tx.cpp 4839

6f449a0bcd82a6893177c269d2c52cca0db58a68ac0b1ab5a75b4f4538fdba64

this is the txid [3:28 PM] PS C:\Users\Acer\Desktop\binaries> .\litecoin-cli.exe -testnet tl_gettransaction 6f449a0bcd82a6893177c269d2c52cca0db58a68ac0b1ab5a75b4f4538fdba64 { "txid": "6f449a0bcd82a6893177c269d2c52cca0db58a68ac0b1ab5a75b4f4538fdba64", "fee": "0.00003600", "sendingaddress": "QboYszrS2QcS4Fph2HQcHRDd3LHvWijsry", "referenceaddress": "QfXnmjnGx98cH7ZqW9KxVXJxQQpfgcGwmH", "ismine": true, "version": 0, "type_int": 114, "type": "Channel Contract Instant Trade", "propertyId": 0, "amount": 140720491777840, "block for expiry": 2599532, "price": 4000000000, "trading action": 2, "leverage": 1, "valid": false, "invalidation reason": "Out of channel deadline"… block was 2599523, expiry was 9 blocks later yet still invalid

static_cast(sp.blocks_until_expiration) - the problem is in how this expression is resolving, probably math is coming out twisted here.

patrickdugan commented 1 year ago

This needs more testing but should be good to go