mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 13:42:49 +02:00
funding: check error to avoid panic during test
This commit, the error returned from `getInitialFwdingPolicy` is checked in order to avoid a nil pointer dereference panic during the TestFundingManagerCustomChannelParameters test.
This commit is contained in:
@@ -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
|
* [Updated several tlv stream-decoding callsites to use tlv/v1.1.0 P2P variants
|
||||||
for untrusted input.](https://github.com/lightningnetwork/lnd/pull/7227)
|
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`
|
## `lncli`
|
||||||
|
|
||||||
* [Add an `insecure` flag to skip tls auth as well as a `metadata` string slice
|
* [Add an `insecure` flag to skip tls auth as well as a `metadata` string slice
|
||||||
|
@@ -4439,10 +4439,7 @@ func (f *Manager) getInitialFwdingPolicy(permChanID lnwire.ChannelID) (
|
|||||||
chanID := make([]byte, 32)
|
chanID := make([]byte, 32)
|
||||||
copy(chanID, permChanID[:])
|
copy(chanID, permChanID[:])
|
||||||
|
|
||||||
value, err := f.cfg.Wallet.Cfg.Database.GetInitialFwdingPolicy(
|
value, err := f.cfg.Wallet.Cfg.Database.GetInitialFwdingPolicy(chanID)
|
||||||
chanID,
|
|
||||||
)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@@ -3082,15 +3082,17 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) {
|
|||||||
|
|
||||||
// After the funding is sigend and before the channel announcement
|
// After the funding is sigend and before the channel announcement
|
||||||
// we expect Alice and Bob to store their respective fees in the database.
|
// we expect Alice and Bob to store their respective fees in the database.
|
||||||
forwardingPolicy, _ := alice.fundingMgr.getInitialFwdingPolicy(fundingSigned.ChanID)
|
forwardingPolicy, err := alice.fundingMgr.getInitialFwdingPolicy(
|
||||||
if err := assertFees(forwardingPolicy, 42, 1337); err != nil {
|
fundingSigned.ChanID,
|
||||||
t.Fatal(err)
|
)
|
||||||
}
|
require.NoError(t, err)
|
||||||
|
require.NoError(t, assertFees(forwardingPolicy, 42, 1337))
|
||||||
|
|
||||||
forwardingPolicy, _ = bob.fundingMgr.getInitialFwdingPolicy(fundingSigned.ChanID)
|
forwardingPolicy, err = bob.fundingMgr.getInitialFwdingPolicy(
|
||||||
if err := assertFees(forwardingPolicy, 100, 1000); err != nil {
|
fundingSigned.ChanID,
|
||||||
t.Fatal(err)
|
)
|
||||||
}
|
require.NoError(t, err)
|
||||||
|
require.NoError(t, assertFees(forwardingPolicy, 100, 1000))
|
||||||
|
|
||||||
// Wait for Alice to published the funding tx to the network.
|
// Wait for Alice to published the funding tx to the network.
|
||||||
var fundingTx *wire.MsgTx
|
var fundingTx *wire.MsgTx
|
||||||
|
Reference in New Issue
Block a user