mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-09-03 12:30:14 +00:00
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
|
// it would have missed notifications as blocks are attached to the
|
||||||
// main chain.
|
// main chain.
|
||||||
func (a *Account) RescanActiveAddresses() {
|
func (a *Account) RescanActiveAddresses() {
|
||||||
a.mtx.RLock()
|
|
||||||
defer a.mtx.RUnlock()
|
|
||||||
|
|
||||||
// Determine the block to begin the rescan from.
|
// Determine the block to begin the rescan from.
|
||||||
|
a.mtx.RLock()
|
||||||
beginBlock := int32(0)
|
beginBlock := int32(0)
|
||||||
if a.fullRescan {
|
if a.fullRescan {
|
||||||
// Need to perform a complete rescan since the wallet creation
|
// 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 active addresses starting at the determined block height.
|
||||||
Rescan(CurrentRPCConn(), beginBlock, a.ActivePaymentAddresses())
|
Rescan(CurrentRPCConn(), beginBlock, a.ActivePaymentAddresses())
|
||||||
|
a.mtx.RUnlock()
|
||||||
a.writeDirtyToDisk()
|
a.writeDirtyToDisk()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue