mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
contractcourt: obtain supplementary HTLC info from the htlcSets
Since we no longer have up to date chain actions on disk, we'll use the HTLC sets in memory which contain the necessary information we need to in order to obtain the HTLC amounts.
This commit is contained in:
parent
8a34b1ae88
commit
087e22d817
1 changed files with 17 additions and 11 deletions
|
@ -438,18 +438,24 @@ func (c *ChannelArbitrator) relaunchResolvers() error {
|
|||
commitHash := contractResolutions.CommitHash
|
||||
|
||||
// Reconstruct the htlc outpoints and data from the chain action log.
|
||||
// The purpose of the constructed htlc map is to supplement to resolvers
|
||||
// restored from database with extra data. Ideally this data is stored
|
||||
// as part of the resolver in the log. This is a workaround to prevent a
|
||||
// db migration.
|
||||
// The purpose of the constructed htlc map is to supplement to
|
||||
// resolvers restored from database with extra data. Ideally this data
|
||||
// is stored as part of the resolver in the log. This is a workaround
|
||||
// to prevent a db migration. We use all available htlc sets here in
|
||||
// order to ensure we have complete coverage.
|
||||
htlcMap := make(map[wire.OutPoint]*channeldb.HTLC)
|
||||
chainActions, err := c.log.FetchChainActions()
|
||||
if err != nil {
|
||||
log.Errorf("unable to fetch chain actions: %v", err)
|
||||
return err
|
||||
for _, htlcs := range c.activeHTLCs {
|
||||
for _, htlc := range htlcs.incomingHTLCs {
|
||||
htlc := htlc
|
||||
outpoint := wire.OutPoint{
|
||||
Hash: commitHash,
|
||||
Index: uint32(htlc.OutputIndex),
|
||||
}
|
||||
for _, htlcs := range chainActions {
|
||||
for _, htlc := range htlcs {
|
||||
htlcMap[outpoint] = &htlc
|
||||
}
|
||||
|
||||
for _, htlc := range htlcs.outgoingHTLCs {
|
||||
htlc := htlc
|
||||
outpoint := wire.OutPoint{
|
||||
Hash: commitHash,
|
||||
Index: uint32(htlc.OutputIndex),
|
||||
|
|
Loading…
Add table
Reference in a new issue