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:
8 files changed
+518
-26
No files matched your search
@@ -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