This commit is contained in:
@@ -426,6 +426,9 @@ func (id *Identity) GetRequestJobs() []RequestsJob {
|
||||
}
|
||||
|
||||
func (id *Identity) SaveBackgroundJob() error {
|
||||
if id.RootKp == nil {
|
||||
return errors.New("identity not fully initialized: RootKp is nil")
|
||||
}
|
||||
var bj BackgroundJob
|
||||
bj.Jobs = id.GetRequestJobs()
|
||||
bj.RootPublic = id.RootKp.Public
|
||||
|
||||
@@ -109,9 +109,13 @@ func (ps *PeerStorage) DeletePeer(uid string) error {
|
||||
defer ps.close()
|
||||
shakey := sha256.Sum256([]byte(uid))
|
||||
key := shakey[:]
|
||||
return ps.db.Update(func(txn *badger.Txn) error {
|
||||
err = ps.db.Update(func(txn *badger.Txn) error {
|
||||
return txn.Delete(key)
|
||||
})
|
||||
if err == nil {
|
||||
delete(ps.cache, uid)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// LoadPeers function loads Peers from the badger database with a specific password
|
||||
|
||||
Reference in New Issue
Block a user