Skip to content

WalletUpdateSpent slower than it aught to be #767

@gavinandresen

Description

@gavinandresen

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions