Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent transaction creation may result in double spends #120

Closed
jrick opened this issue Aug 11, 2014 · 0 comments
Closed

Concurrent transaction creation may result in double spends #120

jrick opened this issue Aug 11, 2014 · 0 comments

Comments

@jrick
Copy link
Member

jrick commented Aug 11, 2014

If btcwallet is hit with many RPC requests to create a transaction (such as sendfrom/sendmany/sendtoaddress) at the same time, the requests will be handled concurrently. Even though there is no data race (as access to transaction store is protected by a mutex), this is a logical race as each request handler will end up choosing some of the same inputs for both transactions, resulting in double spends.

To fix this, a new goroutine which is solely responsible for transaction creation, or even just input selection (if "returning" previously chosen inputs is allowed), should be run, and all sendfrom/many/toaddress requests must communicate with this goroutine to create and sign the transaction.

This did not use to be an issue as all client RPC requests were previously handled serialized.

@jrick jrick self-assigned this Aug 11, 2014
@jrick jrick added bug labels Aug 11, 2014
@jrick jrick changed the title Double spends possible with many transaction requests Concurrent transaction creation may result in double spends Aug 11, 2014
@jrick jrick closed this as completed in 42a494f Aug 12, 2014
@jrick jrick removed their assignment Jan 17, 2015
jrick pushed a commit to jrick/btcwallet that referenced this issue Nov 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant