Effective value coin selection may not work properly with watching only utxos #13906

issue achow101 opened this issue on August 7, 2018
  1. achow101 commented at 8:06 PM on August 7, 2018: member

    Looking through how fees are calculated for calculating the effective value for BnB coin selection, I think there may be an issue with utxos that are considered ISMINE_WATCH_ONLY. Since we cannot solve or sign for these UTXOs, we are unable to calculate the size of the input for these utxos and thus the fee. This means that when we perform BnB on these watching only utxos that the fee will be zero and the effective value will be the entire value. So we could end up with much lower fees than we intend if we are selecting watching only utxos.

    I haven't actually tested this yet, but it seems to be correct if I am following the logic correctly.

  2. sipa commented at 8:30 PM on August 7, 2018: member

    This is only an issue for fundrawtransaction, right? In any other place we only select coins that aren't only watched but we can also sign for.

    For P2PK/P2WPKH we can estimate the size even without being able to solve them. For others, I guess the only options are either refusing to select the coins, return an error, or give a default guess (say, assume every P2SH is P2WSH/3-of-3-multisig or so).

    It could also be an option to fundrawtransaction to enable selection of unsolvable coins, defaulting to off.

  3. achow101 commented at 9:29 PM on August 7, 2018: member

    It turns out I did not follow the logic correctly and missed that GroupOutputs filters for outputs that are spendable (either actually spendable, or solvable and watch only was enabled). Since spendable means that we can construct the scriptSig if we have the private keys, we can estimate the fee for effective value correctly. So this is not a problem.

  4. achow101 closed this on Aug 7, 2018

  5. DrahtBot locked this on Sep 8, 2021
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 00:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me