WalletUpdateSpent slower than it aught to be #767

Closed
gavinandresen opened this Issue Jan 18, 2012 · 1 comment

Projects

None yet

2 participants

@gavinandresen
Member

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

@laanwj
Member
laanwj commented Apr 23, 2014

WalletUpdateSpent doesn't exist anymore, closing

@laanwj laanwj closed this Apr 23, 2014
@destenson destenson pushed a commit to destenson/bitcoin--bitcoin that referenced this issue Jun 26, 2016
@UdjinM6 UdjinM6 fix tests to follow #767 a4c0981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment