CounterpartyXCP / counterwallet

Counterparty web wallet
https://counterwallet.io
147 stars 162 forks source link

Fee calculation issue with sweeping funds #766

Open jdogresorg opened 8 years ago

jdogresorg commented 8 years ago

Sweeping an address with large amounts of assets in it seems to go awry on fee calculations.

For instance, when trying to sweep address 1CXj1bLMekh5XQJt9pygt6xkXVGWtKW3QW the user gets a prompt that 3.97 BTC is needed to sweep this address.

https://gyazo.com/64f15ec114dbfde41314f13f182afb2b

According to blockscan the address 1CXj1bLMekh5XQJt9pygt6xkXVGWtKW3QW has 7784 assets registered to it and a balance of 0.0120993 BTC (+1.2207 BTC in multisig)... Yet when trying to sweep the user gets told they need another 3.97 BTC to do the sweep.?!?

Just some quick math shows the fee calculations are off by a considerable amount.

1 Issuance
------------
  0.00007800 (multisig)
+ 0.00007800 (multisig)
+ 0.00010000 (miners fee)
------------
  0.00025600 BTC per issuance
*       7784 Issuances
------------
  1.99270400 BTC Total

Side-note: Counterwallet seems to work ok with wallets with thousands of assets in them. It took a few minutes for counterwallet to load an address with 7000+ assets in it, but after a few minutes all loaded and worked fine.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/29071955-fee-calculation-issue-with-sweeping-funds?utm_campaign=plugin&utm_content=tracker%2F542579&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F542579&utm_medium=issues&utm_source=github).