mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
Merge pull request #6068 from bhandras/mc_store_fix
routing: fix memory corruption in MC store
This commit is contained in:
commit
f022e557bf
2 changed files with 8 additions and 5 deletions
|
@ -22,6 +22,9 @@
|
||||||
* [Add json flag to
|
* [Add json flag to
|
||||||
trackpayment](https://github.com/lightningnetwork/lnd/pull/6060)
|
trackpayment](https://github.com/lightningnetwork/lnd/pull/6060)
|
||||||
|
|
||||||
|
* [Fix memory corruption in Mission Control
|
||||||
|
Store](https://github.com/lightningnetwork/lnd/pull/6068)
|
||||||
|
|
||||||
## RPC Server
|
## RPC Server
|
||||||
|
|
||||||
* [ChanStatusFlags is now
|
* [ChanStatusFlags is now
|
||||||
|
|
|
@ -82,7 +82,7 @@ func newMissionControlStore(db kvdb.Backend, maxRecords int,
|
||||||
// difference when updating the DB state.
|
// difference when updating the DB state.
|
||||||
c := resultsBucket.ReadCursor()
|
c := resultsBucket.ReadCursor()
|
||||||
for k, _ := c.First(); k != nil; k, _ = c.Next() {
|
for k, _ := c.First(); k != nil; k, _ = c.Next() {
|
||||||
keys.PushBack(k)
|
keys.PushBack(string(k))
|
||||||
keysMap[string(k)] = struct{}{}
|
keysMap[string(k)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ func (b *missionControlStore) storeResults() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
keys.PushBack(k)
|
keys.PushBack(string(k))
|
||||||
keysMap[string(k)] = struct{}{}
|
keysMap[string(k)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,14 +345,14 @@ func (b *missionControlStore) storeResults() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
front := keys.Front()
|
front := keys.Front()
|
||||||
key := front.Value.([]byte)
|
key := front.Value.(string)
|
||||||
|
|
||||||
if err := bucket.Delete(key); err != nil {
|
if err := bucket.Delete([]byte(key)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
keys.Remove(front)
|
keys.Remove(front)
|
||||||
delete(keysMap, string(key))
|
delete(keysMap, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue