emschwartz / ilp3

An implementation of Interledger V3
5 stars 3 forks source link

[XRP] Consider renaming channel.amount to channel.balance #17

Open dappelt opened 6 years ago

dappelt commented 6 years ago

The amount secured by the best claim is stored in channel.amount. However, in the context of XRP paychans, amount refers to the total funding in a channel and balance denotes how much was claimed out of the channel (see rippled and ripple-lib). To avoid confusions, it would be better to stick with the same terminology as rippled and ripple-lib.

emschwartz commented 6 years ago

My understanding of those two terms was basically the opposite (they're pretty poorly named).

From the rippled docs:

Amount (Optional) The amount of XRP, in drops, authorized by the Signature. This must match the amount in the signed message. This is the cumulative amount of XRP that can be dispensed by the channel, including XRP previously redeemed.

That sounds to me like it would be the amount secured by the best claim...

sharafian commented 6 years ago

In parameters of the payment channel creation, Amount is the total to set aside from the sender's funds (https://ripple.com/build/transactions/#paymentchannelcreate). When you fetch the ledger entry it's the Balance that contains how much has been claimed so far.

dappelt commented 6 years ago

In case the part "including XRP previously redeemed" is confusing to you, all that means is that amount will never be decreased during the lifespan of a channel. The channel amount starts at the amount indicated in the channel create transaction and can be increased by channel fund transactions. Claiming funds from the channel does not decrease the amount, but does increase the balance, hence if balance = amount all funds have been claimed.