Possible sendtoaddress improvement? #15885

issue dufferzafar opened this issue on April 24, 2019
  1. dufferzafar commented at 3:56 PM on April 24, 2019: none

    I've been going through all the code that runs to serve a "sendtoaddress" call, to find potential improvements.

    One control flow path looks like: sendtoaddress -> SendMoney -> CreateTransaction -> AvailableCoins + SelectCoins

    Now, AvailableCoins iterates upon all the txn entries in the wallet and stores usable ones into a list. This list is later trimmed down by SelectCoins.

    So, we end up building a huge list every time sendtoaddress is called, only to trim it down later.

    Wouldn't it be better if we could tell AvailableCoins to only select coins of required value?

    I think the nMinimumSumAmount parameter in AvailableCoins was made for this purpose only?

  2. MarcoFalke commented at 5:29 PM on April 24, 2019: member

    How expensive of an operation is it to create the list compared to running the selection logic and signing?

  3. promag commented at 2:55 PM on May 3, 2019: member

    Wouldn't it be better if we could tell AvailableCoins to only select coins of required value?

    SelectCoins needs all of them in order to select the best set for the target value.

    I think the nMinimumSumAmount parameter in AvailableCoins was made for this purpose only?

    No, it was added for listunspent.

  4. MarcoFalke commented at 5:54 PM on May 3, 2019: member

    Closing for now. Though, improvements are definitely welcome as pull requests

  5. MarcoFalke closed this on May 3, 2019

  6. MarcoFalke locked this on Dec 16, 2021

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-05-01 06:15 UTC

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