delivered_amount displays amount for out of range payments (Version: 2.3.1)
Issue Description
Sending payment of amount 0.0000000000000000001 which is out of range and will round down to zero, will yield with successful payment, but RippleState (in case of IOU in this sample) will be not modified - which is OK.
Issue is that delivered_amount will display that something is delivered.
"delivered_amount": {
"currency": "BAR",
"issuer": "raHYzhu84pZxKK2NjKigLmT85D3WamiorR",
"value": "1000000000000000e-34"
}
Steps to Reproduce
Tested on XRPL Testnet with transaction:
{
"TransactionType": "Payment",
"Account": "r4ejfGBMqN9chqA9Xfka9kg5AKkPGvajuz",
"Destination": "raHYzhu84pZxKK2NjKigLmT85D3WamiorR",
"Amount": {
"currency": "BAR",
"value": "0.0000000000000000001",
"issuer": "raHYzhu84pZxKK2NjKigLmT85D3WamiorR"
},
"NetworkID": 1
}
Expected Result
Field delivered_amount should display Amount.value: "0"
Actual Result
Field delivered_amount displays initial sent amount (which was not actually delivered)
Environment
XRPL Testnet via wss://s.altnet.rippletest.net
Testnet Transaction
https://testnet.xrplwin.com/tx/46DC72E67E0A13204A419210130F8D7323F6D4A73FAC1A91F4E2ED4CD853B985
Next steps
Test this with Native currency (XRP) payment.
That amount (1e-34) is a valid amount on ledger, so it's not "out of range". When I looked a few minutes ago the recipient had a balance around 1e9. The STAmount representation has a precision of 15 or 16 decimal places. So, a payment of 1e-3 would be fine. This payment is so small that it basically becomes a rounding error on the account's balance.
As far as the protocol is concerned, the transaction did successfully deliver 1e-34. It just didn't meaningfully change the recipient's balance.
If I had a net worth of a trillion dollars, I wouldn't care if someone sent me a single penny.