supertestnet / superstore

A simple bitcoin webstore with whisper addresses for enhanced privacy
https://supertestnet.github.io/superstore/
Creative Commons Zero v1.0 Universal
97 stars 27 forks source link

Withdrawals do not work #6

Closed GALLAY closed 1 year ago

GALLAY commented 1 year ago

Hi, Withdrawals do not work with me. After entering the address and fee, nothing happens. A new confirmation window like in your video does not appear. Tested in Firefox and Brave, script blocker not active.

supertestnet commented 1 year ago

Uh oh, I don't know what the problem might be, it is working fine for me:

Do you see any error messages in your browser console?

GALLAY commented 1 year ago

Thanks for the quick reply. Maybe this will help?

error

supertestnet commented 1 year ago

Ok that is very helpful, I have a suspicion now about what happened

Did you see a prompt like this?

Please enter a fee rate as a number. Specifically, the number of sats per byte you want to pay. The minimum rate is 18, the average rate is 27, and the urgent rate is 28.

If so, then I think it broke after that. What it is supposed to do at that point is multiply your mining fee rate times the size of your transaction, which is 200 bytes plus an additional 50 bytes for each sale you've made. So if you have 5 sales your mining fee will be (200+(505))27 (assuming you use the average fee) = 12150 sats. Then it crafts your withdrawal transaction, which sends you the sum of all your sales minus the mining fee. In your case I think this resulted in a negative number -- -1954 sats -- which is obviously an invalid amount. So the transaction failed.

Does that sound like a reasonable hypothesis to you? I ask because it's hard to debug remotely so you might have some insight I don't have -- like maybe you're like "no I only had 1 sale and it was for way more than the fee so it was probably something else."

Assuming I identified the problem correctly, I will try to modify the code so that it detects if the transaction fee is more than you have available and then warn you that a withdrawal transaction can't be validly created in that case.

**EDIT: okay I think I show a proper error message now due to this code change: https://github.com/supertestnet/superstore/commit/324d7273771b8e54e7058f9c511b023c66a28caa

GALLAY commented 1 year ago

Thanks, got it. Sounds like that's exactly the problem. I will test it in the coming days again.

supertestnet commented 1 year ago

Closing this issue because I think it is resolved now