HorizenOfficial / Sphere_by_Horizen

85 stars 57 forks source link

Batch withdraw fails with too many vInputs #14

Open PeaStew opened 5 years ago

PeaStew commented 5 years ago

Problem: Sphere's new batch withdraw feature appears to be designed with the assumption that only the number of addresses involved in batch withdraw is relevant to whether a createrawtransaction will be successful when submitting it to the blockchain when in fact in the case of withdrawing from stake addresses it is more likely that the number of input UTXOs is more likely to exceed the tx size limit (10 addresses receiving 7 tx per week over a month will generate 280 UTXO inputs which is may overload the tx size limit) .

Solutions:

  1. Given it is possible to calculate tx size before submission, Sphere should be doing so (which takes minimal computational effort) and then splitting the tx until we achieve an appropriate tx size and informing the user that there will be multiple tx.
  2. Setting arbitrary limits on number of addresses involved in a transaction is not helpful, the only relevant thing is transaction size.
  3. If tx size limits are hit even with (1) apparently correct, Sphere should show a proper error message and fail gracefully, not display internal data to the user