From ece5a293746753e2e6e2ea1b040f7e605d740770 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 4 Jun 2018 16:37:28 -0700 Subject: [PATCH] channeldb: don't reject duplicate waiting proofs In this commit, we modify the waiting proof slightly to acept dupliacte waiting proofs, rather than reject them. Otherwise, it's possible that the remote node first sends us their half of the waiting proof (before we do), we write that to disk, then upon restart, we'll try to add it again, but be rejected by the system. Fixes #1315. --- channeldb/waitingproof.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/channeldb/waitingproof.go b/channeldb/waitingproof.go index c1cebd7de..327ea6286 100644 --- a/channeldb/waitingproof.go +++ b/channeldb/waitingproof.go @@ -56,10 +56,6 @@ func NewWaitingProofStore(db *DB) (*WaitingProofStore, error) { // Add adds new waiting proof in the storage. 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 { var err error var b bytes.Buffer @@ -81,6 +77,7 @@ func (s *WaitingProofStore) Add(proof *WaitingProof) error { } s.cache[proof.Key()] = struct{}{} + return nil }) }