filidorwiese / ripple-wallet

Lightweight command-line Ripple wallet (node based)
ISC License
41 stars 19 forks source link

Minimum balance in sourceAddress should include transaction cost #10

Closed ahdavis181 closed 6 years ago

ahdavis181 commented 6 years ago

https://github.com/filidorwiese/ripple-wallet/blob/46c37ad3e17bab989477a3004e3f621b78857b47/scripts/pay.js#L148

Currently allows for sourceAddress to be funded below reserve amount if fee results in balance going below reserve amount.

ahdavis181 commented 6 years ago

Actually - interestingly, Ripple doesn't reject transactions which result in account balances going below the minimum reserve requirement due to fees only...

https://ripple.com/build/transaction-cost/:

As a rule, the XRP Ledger executes transactions exactly as they are signed. (To do anything else  
 would be difficult to coordinate across a decentralized consensus network, at the least.) As a
 consequence of this, every transaction destroys the exact amount of XRP specified by the Fee field,
 even if the specified amount is much more than the current minimum transaction cost for any part
 of the network. The transaction cost can even destroy XRP that would otherwise be set aside for an
 account's reserve requirement.

https://ripple.com/build/reserves/#going-below-the-reserve-requirement

During transaction processing, the transaction cost destroys some of the sending address's XRP
 balance. This can cause an address's XRP to go below the reserve requirement.

I have tested this, and was able to get an account balance to go below the minimum reserve requirement, currently 20, due to fees.

So, sorry, I guess this is actually not a bug.