Open
Conversation
11b570e to
07f18c9
Compare
07f18c9 to
b061470
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds database persistence for RGB-specific data via the
KVStoreSynctrait, replacing direct filesystem operations with KVStore calls through dependency injection.Changes
New KVStore Functions (
rgb_utils/mod.rs)Added namespace constants and persistence functions:
New functions:
read_rgb_transfer_info/write_rgb_transfer_inforead_rgb_channel_info/write_rgb_channel_info/remove_rgb_channel_inforead_rgb_payment_info/write_rgb_payment_inforead_rgb_consignment/write_rgb_consignment/remove_rgb_consignmentget_rgb_channel_info_pendingis_payment_rgbfilter_first_hopsDependency Injection
KVStore is now passed through struct fields as
Arc<dyn KVStoreSync + Send + Sync>:ChannelManager.rgb_kv_storeChannelManagerReadArgs.rgb_kv_storeChannelContext.rgb_kv_storeOutboundPayments.rgb_kv_storeKeysManager.rgb_kv_storeInMemorySigner.rgb_kv_storeUpdated RGB Functions
All RGB functions now receive KVStore directly instead of filesystem paths:
color_commitment- Reads pending channel info and payment info from KVStore, writes transfer infocolor_htlc- Reads transfer info from KVStore, writes updated transfer infocolor_closing- Reads pending channel info from KVStore, writes transfer infois_channel_rgb- Checks KVStore for channel RGB dataget_rgb_channel_info- Reads from KVStorerename_rgb_files- Renames channel info and consignment entries in KVStorehandle_funding- Writes consignment and channel info to KVStoreupdate_rgb_channel_amount- Reads/writes channel info via KVStoreProxy Key Pattern for HTLC Payments
Payment info uses a proxy key scheme for HTLC tracking:
payment_hash(hex){channel_id}_{payment_hash}{payment_hash}_pendingDesign
rgbprimary namespace with typed secondary namespacesRgbInfo,RgbPaymentInfo, andTransferInfoserialized to KVStoreBreaking Changes
The following public functions now require a
kv_storeparameter instead of filesystem paths:is_channel_rgbkv_store: &KwhereK: KVStoreSyncupdate_rgb_channel_amountkv_store: &KwhereK: KVStoreSyncwrite_rgb_payment_info_filekv_store: &KwhereK: KVStoreSync(also removedldk_data_dir)color_htlckv_store: &dyn KVStoreSynccolor_closingkv_store: &dyn KVStoreSynchandle_fundingkv_store: &KwhereK: KVStoreSyncStruct constructors (
ChannelManager,KeysManager,InMemorySigner,OutboundPayments) now require anrgb_kv_storeparameter.