switch: remove unused code

This commit is contained in:
Andras Banki-Horvath 2020-04-09 20:20:47 +02:00
parent ccf6e2a393
commit b93140cd3c
4 changed files with 12 additions and 15 deletions

@ -535,7 +535,7 @@ func TestCircuitMapPersistence(t *testing.T) {
// Check that the circuit map is empty, even after restarting. // Check that the circuit map is empty, even after restarting.
assertNumCircuitsWithHash(t, circuitMap, hash3, 0) assertNumCircuitsWithHash(t, circuitMap, hash3, 0)
cfg, circuitMap = restartCircuitMap(t, cfg) _, circuitMap = restartCircuitMap(t, cfg)
assertNumCircuitsWithHash(t, circuitMap, hash3, 0) assertNumCircuitsWithHash(t, circuitMap, hash3, 0)
} }
@ -717,7 +717,7 @@ func TestCircuitMapCommitCircuits(t *testing.T) {
// to be loaded from disk. Since the keystone was never set, subsequent // to be loaded from disk. Since the keystone was never set, subsequent
// attempts to commit the circuit should cause the circuit map to // attempts to commit the circuit should cause the circuit map to
// indicate that the HTLC should be failed back. // indicate that the HTLC should be failed back.
cfg, circuitMap = restartCircuitMap(t, cfg) _, circuitMap = restartCircuitMap(t, cfg)
actions, err = circuitMap.CommitCircuits(circuit) actions, err = circuitMap.CommitCircuits(circuit)
if err != nil { if err != nil {
@ -837,7 +837,7 @@ func TestCircuitMapOpenCircuits(t *testing.T) {
// //
// NOTE: The channel db doesn't have any channel data, so no keystones // NOTE: The channel db doesn't have any channel data, so no keystones
// will be trimmed. // will be trimmed.
cfg, circuitMap = restartCircuitMap(t, cfg) _, circuitMap = restartCircuitMap(t, cfg)
// Check that we can still query for the open circuit. // Check that we can still query for the open circuit.
circuit2 = circuitMap.LookupOpenCircuit(keystone.OutKey) circuit2 = circuitMap.LookupOpenCircuit(keystone.OutKey)
@ -1081,7 +1081,7 @@ func TestCircuitMapTrimOpenCircuits(t *testing.T) {
// Restart the circuit map one last time to make sure the changes are // Restart the circuit map one last time to make sure the changes are
// persisted. // persisted.
cfg, circuitMap = restartCircuitMap(t, cfg) _, circuitMap = restartCircuitMap(t, cfg)
assertCircuitsOpenedPostRestart( assertCircuitsOpenedPostRestart(
t, t,
@ -1179,7 +1179,7 @@ func TestCircuitMapCloseOpenCircuits(t *testing.T) {
// //
// NOTE: The channel db doesn't have any channel data, so no keystones // NOTE: The channel db doesn't have any channel data, so no keystones
// will be trimmed. // will be trimmed.
cfg, circuitMap = restartCircuitMap(t, cfg) _, circuitMap = restartCircuitMap(t, cfg)
// Close the open circuit for the first time, which should succeed. // Close the open circuit for the first time, which should succeed.
_, err = circuitMap.FailCircuit(circuit.Incoming) _, err = circuitMap.FailCircuit(circuit.Incoming)
@ -1237,7 +1237,7 @@ func TestCircuitMapCloseUnopenedCircuit(t *testing.T) {
// Now, restart the circuit map, which will result in the circuit being // Now, restart the circuit map, which will result in the circuit being
// reopened, since no attempt to delete the circuit was made. // reopened, since no attempt to delete the circuit was made.
cfg, circuitMap = restartCircuitMap(t, cfg) _, circuitMap = restartCircuitMap(t, cfg)
// Close the open circuit for the first time, which should succeed. // Close the open circuit for the first time, which should succeed.
_, err = circuitMap.FailCircuit(circuit.Incoming) _, err = circuitMap.FailCircuit(circuit.Incoming)
@ -1301,7 +1301,7 @@ func TestCircuitMapDeleteUnopenedCircuit(t *testing.T) {
// Now, restart the circuit map, and check that the deletion survived // Now, restart the circuit map, and check that the deletion survived
// the restart. // the restart.
cfg, circuitMap = restartCircuitMap(t, cfg) _, circuitMap = restartCircuitMap(t, cfg)
circuit2 = circuitMap.LookupCircuit(circuit.Incoming) circuit2 = circuitMap.LookupCircuit(circuit.Incoming)
if circuit2 != nil { if circuit2 != nil {
@ -1374,7 +1374,7 @@ func TestCircuitMapDeleteOpenCircuit(t *testing.T) {
// Now, restart the circuit map, and check that the deletion survived // Now, restart the circuit map, and check that the deletion survived
// the restart. // the restart.
cfg, circuitMap = restartCircuitMap(t, cfg) _, circuitMap = restartCircuitMap(t, cfg)
circuit2 = circuitMap.LookupOpenCircuit(keystone.OutKey) circuit2 = circuitMap.LookupOpenCircuit(keystone.OutKey)
if circuit2 != nil { if circuit2 != nil {

@ -17,9 +17,6 @@ const (
// defaultDbDirectory is the default directory where our decayed log // defaultDbDirectory is the default directory where our decayed log
// will store our (sharedHash, CLTV) key-value pairs. // will store our (sharedHash, CLTV) key-value pairs.
defaultDbDirectory = "sharedhashes" defaultDbDirectory = "sharedhashes"
// dbPermissions sets the database permissions to user write-and-readable.
dbPermissions = 0600
) )
var ( var (

@ -122,7 +122,7 @@ func TestDecayedLogGarbageCollector(t *testing.T) {
time.Sleep(500 * time.Millisecond) time.Sleep(500 * time.Millisecond)
// Assert that hashedSecret is not in the sharedHashBucket // Assert that hashedSecret is not in the sharedHashBucket
val, err = d.Get(hashedSecret) _, err = d.Get(hashedSecret)
if err == nil { if err == nil {
t.Fatalf("CLTV was not deleted") t.Fatalf("CLTV was not deleted")
} }

@ -2040,7 +2040,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) {
// Next, we'll add another HTLC initiated by the switch (of the same // Next, we'll add another HTLC initiated by the switch (of the same
// amount as the prior one). // amount as the prior one).
invoice, htlc, _, err = generatePayment(htlcAmt, htlcAmt, 5, mockBlob) _, htlc, _, err = generatePayment(htlcAmt, htlcAmt, 5, mockBlob)
if err != nil { if err != nil {
t.Fatalf("unable to create payment: %v", err) t.Fatalf("unable to create payment: %v", err)
} }
@ -2143,7 +2143,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) {
} }
htlc.ID = 0 htlc.ID = 0
bobIndex, err = bobChannel.AddHTLC(htlc, nil) _, err = bobChannel.AddHTLC(htlc, nil)
if err != nil { if err != nil {
t.Fatalf("unable to add htlc: %v", err) t.Fatalf("unable to add htlc: %v", err)
} }
@ -2253,7 +2253,7 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) {
// HTLC we add, hence it should have an ID of 1 (Alice's channel // HTLC we add, hence it should have an ID of 1 (Alice's channel
// link will set this automatically for her side). // link will set this automatically for her side).
htlc.ID = 1 htlc.ID = 1
bobIndex, err = bobChannel.AddHTLC(htlc, nil) _, err = bobChannel.AddHTLC(htlc, nil)
if err != nil { if err != nil {
t.Fatalf("unable to add htlc: %v", err) t.Fatalf("unable to add htlc: %v", err)
} }