From 7362d4ecd84baec24d8b70ee2021e63b1b0341ed Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Thu, 6 Aug 2020 13:44:37 -0400 Subject: [PATCH] fix: panic in paych manager if theres an error writing channel state to the datastore when we've already changed chain state --- paychmgr/simple.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paychmgr/simple.go b/paychmgr/simple.go index 67b5a4f419..17ae7cae75 100644 --- a/paychmgr/simple.go +++ b/paychmgr/simple.go @@ -400,20 +400,20 @@ func (ca *channelAccessor) waitAddFundsMsg(channelID string, mcid cid.Cid) error func (ca *channelAccessor) mutateChannelInfo(channelID string, mutate func(*ChannelInfo)) { channelInfo, err := ca.store.ByChannelID(channelID) - // If there's an error reading or writing to the store just log an error. + // Panic if there's an error reading or writing to the store. // For now we're assuming it's unlikely to happen in practice. // Later we may want to implement a transactional approach, whereby // we record to the store that we're going to send a message, send // the message, and then record that the message was sent. if err != nil { - log.Errorf("Error reading channel info from store: %s", err) + panic(fmt.Sprintf("Error reading channel info from store: %s", err)) } mutate(channelInfo) err = ca.store.putChannelInfo(channelInfo) if err != nil { - log.Errorf("Error writing channel info to store: %s", err) + panic(fmt.Sprintf("Error writing channel info to store: %s", err)) } }