Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funding: check error to avoid panic during test #7268

Merged

Conversation

ellemouton
Copy link
Collaborator

@ellemouton ellemouton commented Dec 22, 2022

In this commit, the error returned from getInitialFwdingPolicy is checked in order to avoid a nil pointer dereference panic during the TestFundingManagerCustomChannelParameters test.

Ran into this in one of my other PRs:

--- FAIL: TestFundingManagerCustomChannelParameters (0.02s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe33a20]

goroutine 41 [running]:
testing.tRunner.func1.2({0xf61e60, 0x1acc570})
	/opt/hostedtoolcache/go/1.19.2/x64/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
	/opt/hostedtoolcache/go/1.19.2/x64/src/testing/testing.go:1399 +0x39f
panic({0xf61e60, 0x1acc570})
	/opt/hostedtoolcache/go/1.19.2/x64/src/runtime/panic.go:884 +0x212
github.com/lightningnetwork/lnd/funding.TestFundingManagerCustomChannelParameters.func5(0x0, 0x86b7f02ee78d156c?, 0x3342ac04e1a9f632?)
	/home/runner/work/lnd/lnd/funding/manager_test.go:2992 +0x20
github.com/lightningnetwork/lnd/funding.TestFundingManagerCustomChannelParameters(0xc00046eb60)
	/home/runner/work/lnd/lnd/funding/manager_test.go:3091 +0x16a2
testing.tRunner(0xc00046eb60, 0x1[224](https://github.com/lightningnetwork/lnd/actions/runs/3755899473/jobs/6381383305#step:5:225)1b8)
	/opt/hostedtoolcache/go/1.19.2/x64/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
	/opt/hostedtoolcache/go/1.19.2/x64/src/testing/testing.go:1493 +0x35f

This commit, the error returned from `getInitialFwdingPolicy` is checked
in order to avoid a nil pointer dereference panic during the
TestFundingManagerCustomChannelParameters test.
Copy link
Collaborator

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM🎉 Thanks for the fix!

Copy link
Collaborator

@morehouse morehouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@guggero guggero merged commit c03de26 into lightningnetwork:master Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants