Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Never send cheques when not enough balance in chequebook #1639

Closed
Eknir opened this issue Aug 2, 2019 · 3 comments
Closed

Never send cheques when not enough balance in chequebook #1639

Eknir opened this issue Aug 2, 2019 · 3 comments

Comments

@Eknir
Copy link
Contributor

Eknir commented Aug 2, 2019

SWAP should make sure that the user never ovepromises on his cheques.
If a peer ever writes a cheque that increases the total amount of uncashed cheques above the total amount of balance in the chequebook (assuming no hardDeposits), he risks that his chequebook fires a chequeBounced event and that peers will disconnect (?) from his.

Proposed solution:

  1. Keep track of the amount of all submitted cheques (cashed / uncashed),
  2. keep track of the amount of money deposited. *
  3. Make sure that 1 never goes above 2. Auto-send more funds or temporarily halt all operations until there is money again in the chequebook.
  • the chequebook fires a Deposit event when money is deposited and money can be deposited also outside of the SWARM repository. Therefore, the SWARM sourcecode should just assume naively that only money is deposited via it's own process, but when it attempts to submit money (3), it should query the smart-contract for deposit events before depositing itself, to make sure that the internal account of deposit equals the blockchain count of deposit.
@ralph-pichler
Copy link
Member

In step 1 we need to keep track of all sent cheques not all submitted ones. Not sure wether the method in step 2 is sufficient, there could also be withdrawals in-between.

@mortelli
Copy link
Contributor

duplicate of #1885?

@Eknir
Copy link
Contributor Author

Eknir commented Oct 31, 2019

Yes, duplicate! Closing this issue

@Eknir Eknir closed this as completed Oct 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants