WalletUpdateSpent slower than it aught to be #767

issue gavinandresen opened this issue on January 18, 2012
  1. gavinandresen commented at 10:31 PM on January 18, 2012: contributor

    I have a test wallet with lots of small sendmany transactions, and I noticed that it takes a long time (tens of seconds) for it to complete a send because WalletUpdateSpent is doing a complete write-to-database-and-then-flush for every input. In this case, many of the inputs are from the same previous transaction, so it is re-writing the same record many times.

    Example debug.log output:

    WalletUpdateSpent found spent coin 0.0475bc 4c0f46c6b4d080ce88d3016e1fefca13aac8a544bfcbb5e83d84c95b4b05621f WalletUpdateSpent found spent coin 6.00bc fb27c5e669e7a19bdd79c0f0494cd5911c9497e04b424fc476925d5b6d7bed34 WalletUpdateSpent found spent coin 0.30bc 322e37c01be436b45bc8bf8268f7c89c39619af9d7e003b0eca4ab8113e42244 WalletUpdateSpent found spent coin 0.56bc 3e97e19ae3a5c56dc3c4c4d517213c6d453b696c0779e965a69932f8410b2a5b WalletUpdateSpent found spent coin 0.20bc 898a0d3e571ef73f451e3c0b0989517f72527c6d8da411681cbeaaabeaa8bc9b WalletUpdateSpent found spent coin 0.20bc 898a0d3e571ef73f451e3c0b0989517f72527c6d8da411681cbeaaabeaa8bc9b WalletUpdateSpent found spent coin 0.20bc 898a0d3e571ef73f451e3c0b0989517f72527c6d8da411681cbeaaabeaa8bc9b WalletUpdateSpent found spent coin 0.20bc 898a0d3e571ef73f451e3c0b0989517f72527c6d8da411681cbeaaabeaa8bc9b WalletUpdateSpent found spent coin 0.20bc 898a0d3e571ef73f451e3c0b0989517f72527c6d8da411681cbeaaabeaa8bc9b WalletUpdateSpent found spent coin 0.20bc 898a0d3e571ef73f451e3c0b0989517f72527c6d8da411681cbeaaabeaa8bc9b

    .... etc, for a hundred or so inputs.

    Doing all this in a single database transaction might be easy and make these big-transaction-sends much faster (and aught to be more correct, too).

  2. laanwj commented at 1:42 PM on April 23, 2014: member

    WalletUpdateSpent doesn't exist anymore, closing

  3. laanwj closed this on Apr 23, 2014

  4. destenson referenced this in commit f13b9ad418 on Jun 26, 2016
  5. destenson referenced this in commit a4c098141a on Jun 26, 2016
  6. ptschip referenced this in commit f7b4771e87 on Sep 5, 2017
  7. DrahtBot locked this on Sep 8, 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 00:16 UTC

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