emschwartz / ilp-protocol-paystream

Duplex payment streams over ILP (and PSK)
https://github.com/interledger/rfcs/issues/388
2 stars 2 forks source link

Requesting money with exchange rate can lead to overpayment #26

Open sharafian opened 6 years ago

sharafian commented 6 years ago

When I call setMinAndMaxBalance(10000) on the receiving side, and pass a minimum balance of -Infinity to the sending side, 100081 ends up making it to the receiver. The sender is using USD, and the receiver is using JPY. The source amount sent is 937 at an exchange rate of 106.81.

It appears as though the receiving amount is impossible to hit exactly with these parameters, and if the receiver were to send the 81 micro-yen back, it would be too small to get one micro-dollar. Although I didn't notice anywhere where the receiver attempted to send the excess back.

What should be done in this case?

emschwartz commented 6 years ago

That's tough. I agree that it's strange if you end up with more than you asked for, but it also seems strange to make the default behavior to send that amount back to the connectors. Right now I'd lean towards leaving it the way it is for this case.

It's even harder if we imagine an example where the exchange rate is more like 100000 and the minimum amount of the source units were orders of magnitude bigger than what the receiver is asking for.