{"action":"opened","issue":{"url":"https://api.github.com/repos/decred/dcrwallet/issues/315","repository_url":"https://api.github.com/repos/decred/dcrwallet","labels_url":"https://api.github.com/repos/decred/dcrwallet/issues/315/labels{/name}","comments_url":"https://api.github.com/repos/decred/dcrwallet/issues/315/comments","events_url":"https://api.github.com/repos/decred/dcrwallet/issues/315/events","html_url":"https://github.com/decred/dcrwallet/issues/315","id":170461377,"number":315,"title":"Fix database usage to process changes and make queries atomically.","user":{"login":"jrick","id":1420313,"avatar_url":"https://avatars.githubusercontent.com/u/1420313?v=3","gravatar_id":"","url":"https://api.github.com/users/jrick","html_url":"https://github.com/jrick","followers_url":"https://api.github.com/users/jrick/followers","following_url":"https://api.github.com/users/jrick/following{/other_user}","gists_url":"https://api.github.com/users/jrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrick/subscriptions","organizations_url":"https://api.github.com/users/jrick/orgs","repos_url":"https://api.github.com/users/jrick/repos","events_url":"https://api.github.com/users/jrick/events{/privacy}","received_events_url":"https://api.github.com/users/jrick/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/decred/dcrwallet/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-10T16:32:45Z","updated_at":"2016-08-10T16:32:45Z","closed_at":null,"body":"The current database abstraction packages do not provide a suitable API to safely manage the wallet database.  Blocks can end up being only halfways processed, and other corruption issues are possible as different subsystems accessing the database race.  This must be addressed ASAP to improve wallet reliability and correctness.\r\n\r\nSteps to fix:\r\n\r\n- [ ] Rewrite the dcrd json-rpc block and transaction notifications to produce a single notification for an entire chain switch\r\n- [ ] Modify all of the database abstraction packages in dcrwallet (waddrmgr, wtxmgr, wstakemgr) to take an opened database read or read/write transaction.  This allows the caller to combine several calls together into a single atomic operation\r\n- [ ] Process all dcrd notifications atomically using the fixed APIs.\r\n- [ ] Update all database queries from other subsystems (json-rpc server, gRPC server, etc.) to only open at most a single database transaction.  To a caller, the entire view or operation must be atomic."}}
{"actor":{"display_login":"jrick"}}