Merge pull request #1273 from Roasbeef/fix-switch-panic-deadlock
htlcswitch: ensure we don't attempt to create fwding events for fails
This commit is contained in:
commit
3f78a7419c
@ -63,6 +63,8 @@ func shutdown(dir string, d sphinx.ReplayLog) {
|
|||||||
// to delete expired cltv values every time a block is received. Expired cltv
|
// to delete expired cltv values every time a block is received. Expired cltv
|
||||||
// values are cltv values that are < current block height.
|
// values are cltv values that are < current block height.
|
||||||
func TestDecayedLogGarbageCollector(t *testing.T) {
|
func TestDecayedLogGarbageCollector(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
d, notifier, hashedSecret, err := startup(true)
|
d, notifier, hashedSecret, err := startup(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
||||||
@ -120,6 +122,8 @@ func TestDecayedLogGarbageCollector(t *testing.T) {
|
|||||||
// We test that this causes the <hashedSecret, CLTV> pair to be deleted even
|
// We test that this causes the <hashedSecret, CLTV> pair to be deleted even
|
||||||
// on GC restarts.
|
// on GC restarts.
|
||||||
func TestDecayedLogPersistentGarbageCollector(t *testing.T) {
|
func TestDecayedLogPersistentGarbageCollector(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
d, _, hashedSecret, err := startup(true)
|
d, _, hashedSecret, err := startup(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
||||||
@ -166,6 +170,8 @@ func TestDecayedLogPersistentGarbageCollector(t *testing.T) {
|
|||||||
// sharedHashBucket and then deletes it and finally asserts that we can no
|
// sharedHashBucket and then deletes it and finally asserts that we can no
|
||||||
// longer retrieve it.
|
// longer retrieve it.
|
||||||
func TestDecayedLogInsertionAndDeletion(t *testing.T) {
|
func TestDecayedLogInsertionAndDeletion(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
d, _, hashedSecret, err := startup(false)
|
d, _, hashedSecret, err := startup(false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
||||||
@ -200,6 +206,8 @@ func TestDecayedLogInsertionAndDeletion(t *testing.T) {
|
|||||||
// cltv value is indeed still stored in the sharedHashBucket. We then delete
|
// cltv value is indeed still stored in the sharedHashBucket. We then delete
|
||||||
// the cltv value and check that it persists upon startup.
|
// the cltv value and check that it persists upon startup.
|
||||||
func TestDecayedLogStartAndStop(t *testing.T) {
|
func TestDecayedLogStartAndStop(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
d, _, hashedSecret, err := startup(false)
|
d, _, hashedSecret, err := startup(false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
||||||
@ -262,6 +270,8 @@ func TestDecayedLogStartAndStop(t *testing.T) {
|
|||||||
// via the nested sharedHashBucket and finally asserts that the original stored
|
// via the nested sharedHashBucket and finally asserts that the original stored
|
||||||
// and retrieved cltv values are equal.
|
// and retrieved cltv values are equal.
|
||||||
func TestDecayedLogStorageAndRetrieval(t *testing.T) {
|
func TestDecayedLogStorageAndRetrieval(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
d, _, hashedSecret, err := startup(false)
|
d, _, hashedSecret, err := startup(false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
t.Fatalf("Unable to start up DecayedLog: %v", err)
|
||||||
|
@ -1061,7 +1061,7 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error {
|
|||||||
fail.Reason,
|
fail.Reason,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else if !isFail && circuit.Outgoing != nil {
|
||||||
// If this is an HTLC settle, and it wasn't from a
|
// If this is an HTLC settle, and it wasn't from a
|
||||||
// locally initiated HTLC, then we'll log a forwarding
|
// locally initiated HTLC, then we'll log a forwarding
|
||||||
// event so we can flush it to disk later.
|
// event so we can flush it to disk later.
|
||||||
|
Loading…
Reference in New Issue
Block a user