tdex-network / tdex-daemon

Go implementation of the TDEX Beta Daemon
https://tdex.network
MIT License
11 stars 13 forks source link

[Fragmenter] Disallow split of small amounts #516

Closed Janaka-Steph closed 2 years ago

Janaka-Steph commented 2 years ago

Fragmenter should have a threshold under which splitting too small amounts should be disallowed.

Trying market deposit with 1000 sats for base and quote assets.

$ tdex marketfragmenter balance
{
        "balance": {
                "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49": {
                        "total_balance": "1000",
                        "confirmed_balance": "1000",
                        "unconfirmed_balance": "0"
                },
                "f3d1ec678811398cd2ae277cbe3849c6f6dbd72c74bc542f7c4b11ff0e820958": {
                        "total_balance": "1000",
                        "confirmed_balance": "1000",
                        "unconfirmed_balance": "0"
                }
        }
}
$ tdex marketfragmenter split                                                                 

fetching market fragmenter funds
calculating fragments for market asset pair
detected 2 funds
splitting base asset amount 1000 into 11 fragments
splitting quote asset amount 1000 into 11 fragments
crafting market deposit transaction
[tdex] rpc error: code = Unknown desc = failed to craft market deposit transaction: failed to create a range proof
tiero commented 2 years ago

good point, ie. we should have dust limit treshold @altafan

tiero commented 2 years ago

After discussion offline with @altafan dust limit only makes sense with LBTC. For shitcoin assets it's tricky cause you dont really no the FIAT value of 1 sat of that shitcoin

Janaka-Steph commented 2 years ago

For shitcoins we may know the fiat value on front-end side, so checking there.

tiero commented 2 years ago

For shitcoins we may know the fiat value on front-end side, so checking there.

The only thing we can do now is to show a message eventually to not deposit to little values

tiero commented 2 years ago

This issue made us realize in a bug of the current logic for market fragmentation: we must use the fee account to pay for split & withdraw fees

Closing this in favor of #517