wtclient: add mutex locking in perUpdate

Lock the `backupMu` when accessing `c.chanCommitHeights` in the `New`
function. It is not strictly necessary right now but good to add it so
that there is no accidental oversight if the `perUpdate` method is ever
extracted and reused in future.
This commit is contained in:
Elle Mouton 2023-03-22 11:35:25 +02:00
parent 65dc20f2cc
commit 08cde98869
No known key found for this signature in database
GPG key ID: D7D916376026F177

View file

@ -386,6 +386,9 @@ func New(config *Config) (*TowerClient, error) {
return
}
c.backupMu.Lock()
defer c.backupMu.Unlock()
// Take the highest commit height found in the session's acked
// updates.
height, ok := c.chanCommitHeights[chanID]