mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 14:12:27 +02:00
htlcswitch+lntest: modify Switch to persist resolution messages
Include unit tests for the Switch, and integration tests that exercise the persistence logic.
This commit is contained in:
@ -213,6 +213,10 @@ type CircuitMapConfig struct {
|
||||
// ExtractErrorEncrypter derives the shared secret used to encrypt
|
||||
// errors from the obfuscator's ephemeral public key.
|
||||
ExtractErrorEncrypter hop.ErrorEncrypterExtracter
|
||||
|
||||
// CheckResolutionMsg checks whether a given resolution message exists
|
||||
// for the passed CircuitKey.
|
||||
CheckResolutionMsg func(outKey *CircuitKey) error
|
||||
}
|
||||
|
||||
// NewCircuitMap creates a new instance of the circuitMap.
|
||||
@ -400,7 +404,19 @@ func (cm *circuitMap) cleanClosedChannels() error {
|
||||
// Check if the outgoing channel ID can be found in the
|
||||
// closed channel ID map. Notice that we need to store
|
||||
// the outgoing key because it's used for db query.
|
||||
//
|
||||
// NOTE: We skip this if a resolution message can be
|
||||
// found under the outKey. This means that there is an
|
||||
// existing resolution message(s) that need to get to
|
||||
// the incoming links.
|
||||
if isClosedChannel(outKey.ChanID) {
|
||||
// Check the resolution message store. A return
|
||||
// value of nil means we need to skip deleting
|
||||
// these circuits.
|
||||
if cm.cfg.CheckResolutionMsg(&outKey) == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
keystoneKeySet[outKey] = struct{}{}
|
||||
|
||||
// Also update circuitKeySet to mark the
|
||||
|
Reference in New Issue
Block a user