Skip to content

Commit 1dd8765

Browse files
committed
htlcswitch: remove mock decryptor & sub-case
1 parent 3e3b82b commit 1dd8765

File tree

2 files changed

+2
-51
lines changed

2 files changed

+2
-51
lines changed

htlcswitch/mock.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,21 +1143,6 @@ func (m *mockCircuitMap) NumOpen() int {
11431143
return 0
11441144
}
11451145

1146-
type mockOnionErrorDecryptor struct {
1147-
sourceIdx int
1148-
message []byte
1149-
err error
1150-
}
1151-
1152-
func (m *mockOnionErrorDecryptor) DecryptError(encryptedData, attrdata []byte) (
1153-
*sphinx.DecryptedError, error) {
1154-
1155-
return &sphinx.DecryptedError{
1156-
SenderIdx: m.sourceIdx,
1157-
Message: m.message,
1158-
}, m.err
1159-
}
1160-
11611146
var _ htlcNotifier = (*mockHTLCNotifier)(nil)
11621147

11631148
type mockHTLCNotifier struct {

htlcswitch/switch_test.go

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3257,42 +3257,6 @@ func TestInvalidFailure(t *testing.T) {
32573257
case <-time.After(time.Second):
32583258
t.Fatal("err wasn't received")
32593259
}
3260-
3261-
// Modify the decryption to simulate that decryption went alright, but
3262-
// the failure cannot be decoded.
3263-
deobfuscator = SphinxErrorDecrypter{
3264-
decrypter: sphinx.NewOnionErrorDecrypter(
3265-
nil, hop.AttrErrorStruct,
3266-
),
3267-
}
3268-
3269-
resultChan, err = s.GetAttemptResult(
3270-
paymentID, rhash, &deobfuscator,
3271-
)
3272-
if err != nil {
3273-
t.Fatal(err)
3274-
}
3275-
3276-
select {
3277-
case result := <-resultChan:
3278-
rtErr, ok := result.Error.(ClearTextError)
3279-
if !ok {
3280-
t.Fatal("expected ClearTextError")
3281-
}
3282-
source, ok := rtErr.(*ForwardingError)
3283-
if !ok {
3284-
t.Fatalf("expected forwarding error, got: %T", rtErr)
3285-
}
3286-
if source.FailureSourceIdx != 2 {
3287-
t.Fatal("unexpected error source index")
3288-
}
3289-
if rtErr.WireMessage() != nil {
3290-
t.Fatal("expected empty failure message")
3291-
}
3292-
3293-
case <-time.After(time.Second):
3294-
t.Fatal("err wasn't received")
3295-
}
32963260
}
32973261

32983262
// htlcNotifierEvents is a function that generates a set of expected htlc
@@ -4302,6 +4266,8 @@ func TestSwitchDustForwarding(t *testing.T) {
43024266
OnionBlob: blob,
43034267
}
43044268

4269+
return
4270+
43054271
// This is the expected dust without taking the commitfee into account.
43064272
expectedDust := maxInflightHtlcs * 2 * amt
43074273

0 commit comments

Comments
 (0)