Merge pull request #1323 from Roasbeef/accept-duplicate-waiting-proofs
channeldb: don't reject duplicate waiting proofs
This commit is contained in:
commit
1d994439e2
@ -56,10 +56,6 @@ func NewWaitingProofStore(db *DB) (*WaitingProofStore, error) {
|
|||||||
|
|
||||||
// Add adds new waiting proof in the storage.
|
// Add adds new waiting proof in the storage.
|
||||||
func (s *WaitingProofStore) Add(proof *WaitingProof) error {
|
func (s *WaitingProofStore) Add(proof *WaitingProof) error {
|
||||||
if _, ok := s.cache[proof.Key()]; ok {
|
|
||||||
return ErrWaitingProofAlreadyExist
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.db.Batch(func(tx *bolt.Tx) error {
|
return s.db.Batch(func(tx *bolt.Tx) error {
|
||||||
var err error
|
var err error
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
@ -81,6 +77,7 @@ func (s *WaitingProofStore) Add(proof *WaitingProof) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.cache[proof.Key()] = struct{}{}
|
s.cache[proof.Key()] = struct{}{}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user