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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/release-notes/release-notes-0.16.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ certain large transactions](https://github.com/lightningnetwork/lnd/pull/7100).
* [Updated several tlv stream-decoding callsites to use tlv/v1.1.0 P2P variants
for untrusted input.](https://github.com/lightningnetwork/lnd/pull/7227)

* [Prevent nil pointer dereference during funding manager
test](https://github.com/lightningnetwork/lnd/pull/7268)

## `lncli`

* [Add an `insecure` flag to skip tls auth as well as a `metadata` string slice
Expand Down
5 changes: 1 addition & 4 deletions funding/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4439,10 +4439,7 @@ func (f *Manager) getInitialFwdingPolicy(permChanID lnwire.ChannelID) (
chanID := make([]byte, 32)
copy(chanID, permChanID[:])

value, err := f.cfg.Wallet.Cfg.Database.GetInitialFwdingPolicy(
chanID,
)

value, err := f.cfg.Wallet.Cfg.Database.GetInitialFwdingPolicy(chanID)
if err != nil {
return nil, err
}
Expand Down
18 changes: 10 additions & 8 deletions funding/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3082,15 +3082,17 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) {

// After the funding is sigend and before the channel announcement
// we expect Alice and Bob to store their respective fees in the database.
forwardingPolicy, _ := alice.fundingMgr.getInitialFwdingPolicy(fundingSigned.ChanID)
if err := assertFees(forwardingPolicy, 42, 1337); err != nil {
t.Fatal(err)
}
forwardingPolicy, err := alice.fundingMgr.getInitialFwdingPolicy(
fundingSigned.ChanID,
)
require.NoError(t, err)
require.NoError(t, assertFees(forwardingPolicy, 42, 1337))

forwardingPolicy, _ = bob.fundingMgr.getInitialFwdingPolicy(fundingSigned.ChanID)
if err := assertFees(forwardingPolicy, 100, 1000); err != nil {
t.Fatal(err)
}
forwardingPolicy, err = bob.fundingMgr.getInitialFwdingPolicy(
fundingSigned.ChanID,
)
require.NoError(t, err)
require.NoError(t, assertFees(forwardingPolicy, 100, 1000))

// Wait for Alice to published the funding tx to the network.
var fundingTx *wire.MsgTx
Expand Down