ethersphere / swarm-cli

Manage your Bee node and interact with the Swarm network via the CLI
BSD 3-Clause "New" or "Revised" License
48 stars 21 forks source link

Add option to withdraw all funds from chequebook to wallet #499

Closed crtahlin closed 1 month ago

crtahlin commented 3 months ago

Add option to withdraw all funds from chequebook to wallet, for example:

swarm-cli cheque withdraw --all

Would withdraw all the funds from the chequebook to the wallet. This would be used used when shutting down a bee node.

The could also be an option to withdraw just available funds (not the owed amounts), e.g.:

swarm-cli cheque withdraw --all-available
ldeffenb commented 3 months ago

Wait, are you saying that it is possible to withdraw the owed amounts and not just up to the available funds? So, you can have a node that issues a bunch of cheques, then withdraw the full amount and if/when those cheques are cashed, they will bounce?

crtahlin commented 3 months ago

Actually, my node(s) did not have any owed amounts, so I just presumed that any withdrawal is possible, even all the funds. If not, then off course just one option is needed. Or maybe in any case just one option is needed, but off course then it also makes sense to add the limit is manual amount is entered (if it does not exist currently), to allow withdrawal only up to what is not owed.

crtahlin commented 3 months ago

It does say here: https://docs.ethswarm.org/docs/bee/working-with-bee/cashing-out/

"Holding on to a swap-cheque is risky; it is possible that the owner of the chequebook has issued cheques worth more xBZZ than is contained in their chequebook contract."

But I guess they would be using some kind of malicious Bee nodes to get to that state, a proper Bee should probably not allow that (?).

ldeffenb commented 3 months ago

But I guess they would be using some kind of malicious Bee nodes to get to that state, a proper Bee should probably not allow that (?).

That was my understanding. I have certainly not seen any of my nodes overdraw the chequebook, and I have had some nodes take it down to near zero available. They just stop issuing cheques and slow themselves down to the pseudo- "free" settlements until I deposit more to the chequebook.