Release reader lock before syncing to disk.
When disk syncing a wallet file, if the wallet is flagged dirty, the disk syncer must grab the wallet writer lock to set dirty=false. The disk syncing code was being called in the end of (*Account).RescanActiveAddresses with the reader lock held (unlocked using a defer), which prevented the writer lock from being aquired. This change removes the defered unlock to release the reader lock before syncing to disk.
This commit is contained in:
parent
d811f38309
commit
3b9d84b1e2
1 changed files with 2 additions and 3 deletions
|
@ -473,10 +473,8 @@ func (a *Account) Track() {
|
|||
// it would have missed notifications as blocks are attached to the
|
||||
// main chain.
|
||||
func (a *Account) RescanActiveAddresses() {
|
||||
a.mtx.RLock()
|
||||
defer a.mtx.RUnlock()
|
||||
|
||||
// Determine the block to begin the rescan from.
|
||||
a.mtx.RLock()
|
||||
beginBlock := int32(0)
|
||||
if a.fullRescan {
|
||||
// Need to perform a complete rescan since the wallet creation
|
||||
|
@ -498,6 +496,7 @@ func (a *Account) RescanActiveAddresses() {
|
|||
|
||||
// Rescan active addresses starting at the determined block height.
|
||||
Rescan(CurrentRPCConn(), beginBlock, a.ActivePaymentAddresses())
|
||||
a.mtx.RUnlock()
|
||||
a.writeDirtyToDisk()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue