Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bisq does not add "dust" outputs to miner fee #4039

Closed
wiz opened this issue Mar 10, 2020 · 5 comments
Closed

Bisq does not add "dust" outputs to miner fee #4039

wiz opened this issue Mar 10, 2020 · 5 comments
Labels

Comments

@wiz
Copy link
Member

wiz commented Mar 10, 2020

Background

According to Bitcoin consensus rules, no output can be less than 546 sats. If a transaction with such an output is broadcast, it will be rejected.

Description

Bisq attempts to broadcast Bitcoin transactions containing "dust" outputs, instead of simply adding the dust to the miner fee like most wallets do.

Version

v1.2.7

Steps to reproduce

This is the difficult part, as users randomly do this if their transaction coincidentally results in an output of less than 546 sats. However, since Bisq assumes transactions it creates are valid (without checking the dust rule), this results in triggering other random Bisq issues. Sometimes it results in a failed trade, sometimes it results in a corrupted wallet.

Expected behaviour

The dust output should not be created, and instead added to fees.

Actual behaviour

The dust output is created, and the Bitcoin transaction is rejected, causing further issues in Bisq depending on the situation.

@ripcurlx
Copy link
Contributor

The dust output is created, and the Bitcoin transaction is rejected, causing further issues in Bisq depending on the situation.

So you had actual transactions with outputs below the dust limit? I though we had some dust check in place already during transaction creation, so I just wanted to make sure before someone digs into this codebase.

One more thing: to prevent confusion what is up for compensation and what isn't please don't add issues to the critical bugs board on your own. Otherwise devs might pick it up by mistake and not getting compensated if the issue is not getting the is:critical label in the end.

@wiz
Copy link
Member Author

wiz commented Mar 11, 2020

Yes, this is a common recurring issue in Bisq, @huey735 how many cases would you say you've seen caused by "the dust issue" ?

@ripcurlx ripcurlx added a:bug is:critical https://bisq.wiki/Critical_bug labels Mar 11, 2020
@huey735
Copy link
Member

huey735 commented Mar 12, 2020

@wiz recently I can at least think of these two:

The first one is slightly different from what this issue is about but it also demonstrates Bisq inability to manage dust values.

@ghost
Copy link

ghost commented Mar 17, 2020

example in P2P wallet

  1. Bob chooses send from a single UTXO containing 0.1 BTC
  2. he sends 0.099995 BTC to Alice, with "amount includes mining fee" set.
  3. A transaction is generated and written to the log file:
    0.09993624 to Alice
    0.00005876 mining fee
    0.00000500 to Bob's change address
  4. no error is given about dust amounts.
  5. the transaction is posted on Bob's wallet and his available balance goes to zero.
  6. the transaction does not reach the blockchain, shows as pending on Bob's wallet.
  7. no error shown in the log
    even after reboot it stays "lost".
    deleting SPV files clears out the erroneous tx.

example when creating a trade offer

  1. Bob has 0.05758564 in his wallet. (in a single UTXO for simplicity)
  2. Bob creates an offer to sell 0.05 BTC at market price. Plus 0.0075 for the security deposit, 0.00005 for the maker fee (goes to the DAO).
  3. Bisq creates and broadcasts the maker transaction as above, with 0.00003120 miner fees leaving 0.00000444 as change back to Bob's wallet. Since 444 sats is below the dust threshold, the transaction does not reach the blockchain. No error is reported either in the log or the application.
  4. Bob's offer is published to the Bisq network.
  5. Alice takes Bob's offer. The trade stays forever stuck at step 1, wait for 1 blockchain confirmation.

example when taking a trade offer

  1. Alice makes an offer to sell 0.05 BTC at market price.
  2. Bob wants to buy Bitcoin, but his wallet is empty. Bisq tells Bob that he needs 0.007878 BTC to take the offer.
  3. Bob funds his Bisq wallet with 0.007879 BTC.
  4. Bob then takes the offer.
  5. Bisq creates and broadcasts the taker transaction, with 0.00015 to the DAO, 0.007652 deposit, 0.00007600 miner fees leaving 0.00000100 as change back to Bob's wallet. Since 100 sats is below the dust threshold, the transaction does not reach the blockchain. No error is reported either in the log or the application.
  6. Alice receives notification that her order has been taken. The trade stays forever stuck at step 1, wait for 1 blockchain confirmation.

@wiz
Copy link
Member Author

wiz commented May 7, 2020

Closing as fixed, thanks @jmacxx for your help on this!

@wiz wiz closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants