swarm
swarm copied to clipboard
Being sure you got the money
When cashing a cheque, we should include a cheque on actually getting the money from the chequebook after cashing the cheque.
This can be done by:
- reading the balance of the peer (in wei) before cashing the cheque
- keeping track of the execution costs - read this by calculating:
receipt.GasUsed * auth.gasPrice
- reading the balance of the peer (in wei) after cashing the cheque
- verifying wether 3 - 1 -2 equals the amount you were cashing.
This logic could lead to potential problems if multiple cheques for different beneficiaries are cashed at the same time. A better approach would be to check for the relevant event.
In #1683 we now verify wether the cashing worked. But we don't do anything with error yet.
@ralph-pichler , what is the status on this PR?
For this to be complete there 2 things needed:
- make sure that we monitor the cashout transactions (depends on #2005)
- blacklist the peer if bounced (depends on #2025 being implemented)