]> git.bitcoin.ninja Git - rust-lightning/commit
(Re-)add handling for `ChannelUpdate::message_flags`
authorMatt Corallo <git@bluematt.me>
Tue, 25 Jun 2024 16:20:59 +0000 (16:20 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 1 Jul 2024 23:46:34 +0000 (23:46 +0000)
commitdc3f8261231321151590a15ccb8c8dcd773e8d9c
tree2f33b1b92eb498224e738d511515b83d70e7f6e7
parent88e1b56d66ff550b36a6d422f47c9b9729406f61
(Re-)add handling for `ChannelUpdate::message_flags`

When the `htlc_maximum_msat` field was made mandatory in
`ChannelUpdate` (in b0e8b739b73cc25f3e1ab00695a14d972162a140) we
started ignoring the `message_flags` field entirely and always
writing `1`. The comment updates indicated that the `message_flags`
field was deprecated, but this is not true - only the
`htlc_maximum_msat` indicator bit was deprecated, requiring it to
be 1.

If a node creates a `channel_update` with `message_flags` bits set
other than the low bit, this will cause us to spuriously reject
the message with an invalid signature error as we will check the
message against the wrong hash.

With today's current spec this is totally fine - the only other bit
defined for `message_flags` is the `dont_forward` bit, which when
set indicates we shouldn't accept the message into our gossip store
anyway (though this may lead to spurious `warning` messages being
sent to peers). However, in the future this may mean we start
rejecting valid `channel_update`s if new bits are defiend.
18 files changed:
fuzz/src/chanmon_consistency.rs
fuzz/src/full_stack.rs
lightning-rapid-gossip-sync/src/processing.rs
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/msgs.rs
lightning/src/ln/onion_route_tests.rs
lightning/src/ln/priv_short_conf_tests.rs
lightning/src/ln/shutdown_tests.rs
lightning/src/routing/gossip.rs
lightning/src/routing/router.rs
lightning/src/routing/scoring.rs
lightning/src/routing/test_utils.rs
lightning/src/routing/utxo.rs
lightning/src/util/test_utils.rs