Merge pull request #620 from wpaulino/waddrmgr-rlock-sync
waddrmgr: use RLock when retrieving sync info
This commit is contained in:
commit
2c05240dff
1 changed files with 4 additions and 6 deletions
|
@ -74,8 +74,8 @@ func (m *Manager) SetSyncedTo(ns walletdb.ReadWriteBucket, bs *BlockStamp) error
|
|||
// can use this information for intelligently initiating rescans to sync back to
|
||||
// the best chain from the last known good block.
|
||||
func (m *Manager) SyncedTo() BlockStamp {
|
||||
m.mtx.Lock()
|
||||
defer m.mtx.Unlock()
|
||||
m.mtx.RLock()
|
||||
defer m.mtx.RUnlock()
|
||||
|
||||
return m.syncState.syncedTo
|
||||
}
|
||||
|
@ -85,8 +85,6 @@ func (m *Manager) SyncedTo() BlockStamp {
|
|||
// reorg is taking place and how far back it goes.
|
||||
func (m *Manager) BlockHash(ns walletdb.ReadBucket, height int32) (
|
||||
*chainhash.Hash, error) {
|
||||
m.mtx.Lock()
|
||||
defer m.mtx.Unlock()
|
||||
|
||||
return fetchBlockHash(ns, height)
|
||||
}
|
||||
|
@ -94,8 +92,8 @@ func (m *Manager) BlockHash(ns walletdb.ReadBucket, height int32) (
|
|||
// Birthday returns the birthday, or earliest time a key could have been used,
|
||||
// for the manager.
|
||||
func (m *Manager) Birthday() time.Time {
|
||||
m.mtx.Lock()
|
||||
defer m.mtx.Unlock()
|
||||
m.mtx.RLock()
|
||||
defer m.mtx.RUnlock()
|
||||
|
||||
return m.birthday
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue