sqldb+graph/db: add channel tables and implement some channel CRUD#9869
Conversation
|
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
08fc1d6 to
2d0c276
Compare
2d0c276 to
7720c7d
Compare
| node_id_2 BIGINT NOT NULL REFERENCES nodes(id) ON DELETE CASCADE, | ||
|
|
||
| -- The outpoint of the funding transaction. | ||
| outpoint TEXT NOT NULL, |
There was a problem hiding this comment.
Is this going to be hex encoded? Perhaps we can save some bytes here and use a serialized outpoint, stored as a BLOB?
There was a problem hiding this comment.
so it's currently the string: "txid:index" which is nice for users to be able to query by i'd say.
The other option is to switch it to BLOB and then use our WriteOutpoint encoding helper to serialise the outpoint. But then it isnt really useful from a user perspective
There was a problem hiding this comment.
Def recommend using the string version of any txids we store as reversing bytes is really hard in SQL (likely not even possible in SQLite), so debugging would be quite a bit harder.
7720c7d to
0d15b99
Compare
In this commit, we define the SQL schemas for storing graph channel data. This includes a new `channels` table and a new `channel_features` table along with various indices.
In preparation for having consistency with the structs created by the SQLStore and the KVStore (so that they have the same behaviour when tested by the unit tests), here we make sure not to init the ExtraOpaqueData field of the LightningNode struct unless there are actualy bytes to set.
Expand the existing TestAddChannelEdgeShellNodes test so that we have coverage for error we expect when AddChannelEdge is called a second time if we already know of a channel.
In this commit, the `AddChannelEdge` method of the SQLStore is implemented. Like the KVStore implementation, it makes use of the available channel `batch.Scheduler` and also updates the reject and channel caches. This then lets us convert the following 2 unit tests to run against the SQL backends: - TestPartialNode - TestAddChannelEdgeShellNodes
0d15b99 to
cf54245
Compare
|
cc @guggero for override merge 🙏 |
In this PR, the following schemas are defined for storing graph channel data. NOTE the
nodestable here is only to showhow it fits - the full nodes picture can be seen here.
The following methods are then implemented on the SQLStore:
This then allows us to run the following unit tests against the SQL backends:
Part of #9795