graph/db: validate edge policy TLV data before persisting
In this commit, we start validating the extra opaque data of a channel edge policy before persisting it. We just check that the data is valid TLV. NOTE: we recently [started validating](https://github.com/lightningnetwork/lnd/commit/1410a0949d555e14de11faf81a17fe64917505e3) this at the lnwire level. So really, no new update will reach the DB layer without this already being checked. But we check it again here so that the DB API behaves correctly as its own unit.
This commit is contained in:
3 files changed
+22
-6
No files matched your search
@@ -12,6 +12,10 @@ var (
|
||||
ErrEdgePolicyOptionalFieldNotFound = fmt.Errorf("optional field not " +
|
||||
"present")
|
||||
|
||||
// ErrParsingExtraTLVBytes is returned when we attempt to parse
|
||||
// extra opaque bytes as a TLV stream, but the parsing fails.
|
||||
ErrParsingExtraTLVBytes = fmt.Errorf("error parsing extra TLV bytes")
|
||||
|
||||
// ErrGraphNotFound is returned when at least one of the components of
|
||||
// graph doesn't exist.
|
||||
ErrGraphNotFound = fmt.Errorf("graph bucket not initialized")
|
||||
|
||||
Reference in new issue
Block a user