multi: remove dead code

This commit is contained in:
Joost Jager committed 2019-09-10 17:21:59 +02:00
1 parent 5d016f8c62
commit 3d7de2ad39
71 files changed
+35 -766

No files matched your search

-23
View File
@@ -550,18 +550,6 @@ func assertHasKeystone(t *testing.T, cm htlcswitch.CircuitMap,
}
}
// assertDoesNotHaveKeystone tests that the circuit map does not contain a
// circuit for the provided outgoing circuit key.
func assertDoesNotHaveKeystone(t *testing.T, cm htlcswitch.CircuitMap,
outKey htlcswitch.CircuitKey) {
circuit := cm.LookupOpenCircuit(outKey)
if circuit != nil {
t.Fatalf("expected no circuit for keystone %s, found %v",
outKey, circuit)
}
}
// assertHasCircuitForHash tests that the provided circuit appears in the list
// of circuits for the given hash.
func assertHasCircuitForHash(t *testing.T, cm htlcswitch.CircuitMap, hash [32]byte,
@@ -619,17 +607,6 @@ func equalIgnoreLFD(c, c2 *htlcswitch.PaymentCircuit) bool {
return isEqual
}
// assertDoesNotHaveCircuit queries the circuit map using the circuit's
// incoming circuit key, and fails if it is found.
func assertDoesNotHaveCircuit(t *testing.T, cm htlcswitch.CircuitMap,
c *htlcswitch.PaymentCircuit) {
c2 := cm.LookupCircuit(c.Incoming)
if c2 != nil {
t.Fatalf("expected no circuit for %v, got %v", c, c2)
}
}
// makeCircuitDB initializes a new test channeldb for testing the persistence of
// the circuit map. If an empty string is provided as a path, a temp directory
// will be created.
-4
View File
@@ -321,10 +321,6 @@ type channelLink struct {
// been processed because of the commitment transaction overflow.
overflowQueue *packetQueue
// startMailBox directs whether or not to start the mailbox when
// starting the link. It may have already been started by the switch.
startMailBox bool
// mailBox is the main interface between the outside world and the
// link. All incoming messages will be sent over this mailBox. Messages
// include new updates from our connected peer, and new packets to be
-7
View File
@@ -1690,7 +1690,6 @@ func newSingleLinkTestHarness(chanAmt, chanReserve btcutil.Amount) (
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
}
const startingHeight = 100
aliceLink := NewChannelLink(aliceCfg, aliceLc.channel)
start := func() error {
return aliceSwitch.AddLink(aliceLink)
@@ -4035,10 +4034,6 @@ func TestChannelLinkAcceptOverpay(t *testing.T) {
}
}
// chanRestoreFunc is a method signature for functions that can reload both
// endpoints of a link from their persistent storage engines.
type chanRestoreFunc func() (*lnwallet.LightningChannel, *lnwallet.LightningChannel, error)
// persistentLinkHarness is used to control the lifecylce of a link and the
// switch that operates it. It supports the ability to restart either the link
// or both the link and the switch.
@@ -4256,7 +4251,6 @@ func (h *persistentLinkHarness) restartLink(
MaxFeeAllocation: DefaultMaxLinkFeeAllocation,
}
const startingHeight = 100
aliceLink := NewChannelLink(aliceCfg, aliceChannel)
if err := aliceSwitch.AddLink(aliceLink); err != nil {
return nil, nil, nil, err
@@ -5394,7 +5388,6 @@ func TestChannelLinkFail(t *testing.T) {
}
const chanAmt = btcutil.SatoshiPerBitcoin * 5
const chanReserve = 0
// Execute each test case.
for i, test := range testCases {
-1
View File
@@ -63,7 +63,6 @@ type memoryMailBox struct {
stopped sync.Once
wireMessages *list.List
wireHead *list.Element
wireMtx sync.Mutex
wireCond *sync.Cond
-4
View File
@@ -128,8 +128,6 @@ type mockServer struct {
name string
messages chan lnwire.Message
errChan chan error
id [33]byte
htlcSwitch *Switch
@@ -625,8 +623,6 @@ type mockChannelLink struct {
peer lnpeer.Peer
startMailBox bool
mailBox MailBox
packets chan *htlcPacket
-8
View File
@@ -21,14 +21,6 @@ type htlcPacket struct {
// on the incoming channel.
incomingHTLCID uint64
// incomingHtlcAmt is the value of the *incoming* HTLC. This will be
// set by the link when it receives an incoming HTLC to be forwarded
// through the switch. Then the outgoing link will use this once it
// creates a full circuit add. This allows us to properly populate the
// forwarding event for this circuit/packet in the case the payment
// circuit is successful.
incomingHtlcAmt lnwire.MilliSatoshi
// outgoingHTLCID is the ID of the HTLC that we offered to the peer on the
// outgoing channel.
outgoingHTLCID uint64
-21
View File
@@ -2,7 +2,6 @@ package htlcswitch
import (
"bytes"
"crypto/sha256"
"errors"
"fmt"
"sync"
@@ -66,10 +65,6 @@ var (
// ErrUnreadableFailureMessage is returned when the failure message
// cannot be decrypted.
ErrUnreadableFailureMessage = errors.New("unreadable failure message")
// zeroPreimage is the empty preimage which is returned when we have
// some errors.
zeroPreimage [sha256.Size]byte
)
// plexPacket encapsulates switch packet and adds error channel to receive
@@ -258,10 +253,6 @@ type Switch struct {
// messages will be sent over.
resolutionMsgs chan *resolutionMsg
// linkControl is a channel used to propagate add/remove/get htlc
// switch handler commands.
linkControl chan interface{}
// pendingFwdingEvents is the set of forwarding events which have been
// collected during the current interval, but hasn't yet been written
// to the forwarding log.
@@ -2225,18 +2216,6 @@ func (s *Switch) deleteCircuits(inKeys ...CircuitKey) error {
return s.circuits.DeleteCircuits(inKeys...)
}
// lookupCircuit queries the in memory representation of the circuit map to
// retrieve a particular circuit.
func (s *Switch) lookupCircuit(inKey CircuitKey) *PaymentCircuit {
return s.circuits.LookupCircuit(inKey)
}
// lookupOpenCircuit queries the in-memory representation of the circuit map for a
// circuit whose outgoing circuit key matches outKey.
func (s *Switch) lookupOpenCircuit(outKey CircuitKey) *PaymentCircuit {
return s.circuits.LookupOpenCircuit(outKey)
}
// FlushForwardingEvents flushes out the set of pending forwarding events to
// the persistent log. This will be used by the switch to periodically flush
// out the set of forwarding events to disk. External callers can also use this
+1 -9
View File
@@ -41,15 +41,7 @@ var (
bobPrivKey = []byte("bob priv key")
carolPrivKey = []byte("carol priv key")
testPrivKey = []byte{
0x81, 0xb6, 0x37, 0xd8, 0xfc, 0xd2, 0xc6, 0xda,
0x63, 0x59, 0xe6, 0x96, 0x31, 0x13, 0xa1, 0x17,
0xd, 0xe7, 0x95, 0xe4, 0xb7, 0x25, 0xb8, 0x4d,
0x1e, 0xb, 0x4c, 0xfd, 0x9e, 0xc5, 0x8c, 0xe9,
}
_, testPubKey = btcec.PrivKeyFromBytes(btcec.S256(), testPrivKey)
testSig = &btcec.Signature{
testSig = &btcec.Signature{
R: new(big.Int),
S: new(big.Int),
}