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

Fix for dust error when redeeming P2SH-B #17

Closed
wants to merge 3 commits into from
Closed

Fix for dust error when redeeming P2SH-B #17

wants to merge 3 commits into from

Conversation

archived-2
Copy link

@archived-2 archived-2 commented Aug 16, 2020

I have committed my fix for the 'dust' error #14 when attempting to redeem P2SH-B with a zero amount. It is now redeeming 1000 sats, which was enough to allow a mainnet transaction to progress and ultimately succeed.

The trade-off of this approach is that the seller receives an extra 1000 sats, rather than them being used as part of the fee. In my trade, the remaining 4000 sats were still enough for the transaction to be included in a block 9 hours later, and this delay didn't affect the trade in any noticeable way.

I'll completely understand if you want to come up with better fix than this, but since it worked correctly for me and unblocks a critical issue with the TradeBot, I figured I'd submit a pull request.

CalDescent added 3 commits August 16, 2020 17:02
…aused the Electrum nodes to fail with a 'dust' error. Ideally we need to redeem at least 700 sats in order to stand a chance of exceeding the dust threshold (3000 sats/kB).
… transaction is also rejected due to the 'dust' error. Note: we can probably skip this entire step, as the majority of the P2SA-B balance is needed to pay for its own transaction fee, even when refunded.
@archived-2
Copy link
Author

archived-2 commented Aug 16, 2020

I've applied the same logic when refunding P2SH-B, as I ran a mainnet test and this was also failing with the same 'dust' error. As a result of the fix, the buyer is now refunded 1000 sats and the remaining 4000 sats are used to pay the transaction fee. Longer term it may be easier to just skip this entire step, as it's not achieving much. I see you've mentioned that in the comments.

After applying this 1000 sat redemption, my mainnet trade was able to proceed to the next step (the P2SH-A refund).

2020-08-16 20:35:08 INFO TradeBot:996 - Refunded P2SH-B 37WM5KBKYwkZNKB9Kox3DFcX9oH4rNLtUY. Waiting for LockTime-A

@catbref
Copy link
Collaborator

catbref commented Sep 1, 2020

Thanks for spotting this...

Closing without merge as this was fixed as part of implementing what you spotted in PR #18 !

@catbref catbref closed this Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants