Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic if there's a datastore err when writing state to datastore after chain msg #2870

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions paychmgr/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down