channeldb: also update chanInfo when updating commitment
In this commit, we fix an existing bug wherein we failed to update the channels state once we accepted a new commitment. As a result, after a state transition, if the channel state was read from disk, values like TotalMSatSent wouldn’t be properly updated.
This commit is contained in:
parent
150ab00842
commit
3875754e0f
@ -629,9 +629,19 @@ func (c *OpenChannel) UpdateCommitment(newCommitment *ChannelCommitment) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = putChanInfo(chanBucket, c); err != nil {
|
||||
return fmt.Errorf("unable to store chan info: %v", err)
|
||||
}
|
||||
|
||||
// With the proper bucket fetched, we'll now write toe latest
|
||||
// commitment state to dis for the target party.
|
||||
return putChanCommitment(chanBucket, newCommitment, true)
|
||||
err = putChanCommitment(chanBucket, newCommitment, true)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to store chan "+
|
||||
"revocations: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user