Skip to content

sea-orm integration + rust-lightning persitence layer#95

Open
dcorral wants to merge 1 commit intoRGB-Tools:masterfrom
dcorral:rust-lightning-tx-persistence
Open

sea-orm integration + rust-lightning persitence layer#95
dcorral wants to merge 1 commit intoRGB-Tools:masterfrom
dcorral:rust-lightning-tx-persistence

Conversation

@dcorral
Copy link

@dcorral dcorral commented Feb 17, 2026

Summary

Replaces file-based persistence with SQLite database using sea-orm ORM.

Changes

New database tables:

  • mnemonic - encrypted mnemonic storage
  • kv_store - LDK persistence (channel manager, payments, swaps, network graph, scorer)
  • config - configuration key/value pairs (indexer_url, proxy_url, etc.)
  • revoked_token - revoked auth token IDs
  • channel_peer - channel peer pubkey/address mapping

Migrated to database:

  • Mnemonic (was encrypted file)
  • All LDK KVStore data (channel manager, inbound/outbound payments, swaps, scorer)
  • Config parameters (synced to files for rust-lightning compatibility)
  • Revoked tokens (was flat file)
  • Channel peer data (was flat file)
  • PSBTs (temporary storage during channel funding)
  • Output spender transactions

Architecture:

  • Single shared DatabaseConnection via Arc
  • SeaOrmKvStore implements rust-lightning's KVStoreSync trait
  • Migrations run automatically on startup
  • Config stored in DB as source of truth, synced to files for rust-lightning compatibility

rust-lightning submodule (961313cb061470):

  • RGB data persistence moved from filesystem to KVStoreSync trait across 8 files
  • rgb_utils/mod.rs: replaced file I/O (read_rgb_transfer_info, write_rgb_transfer_info, parse_rgb_payment_info, get_rgb_channel_info_path) with KVStore namespace-based read/write operations using RGB_PRIMARY_NS + secondary namespaces (channel_info, payment_info_inbound, payment_info_outbound, transfer_info, etc.)
  • ChannelContext, ChannelManager, OutboundPayments, KeysManager: added rgb_kv_store: Arc<dyn KVStoreSync + Send + Sync> field, threaded through constructors and deserialization
  • color_commitment, color_htlc, color_closing: now take &dyn KVStoreSync instead of reading files directly
  • is_channel_rgb, get_rgb_channel_info, rename_rgb_files, filter_first_hops, is_payment_rgb: switched from path-based lookups to KVStore reads
  • Removed filesystem fallback — KVStore is now the sole persistence backend for RGB data

IMPORTANT!
This PR depends on RGB-Tools/rust-lightning#17 and .submodule must be updated to point to the right RGB-Tools fork before merging

@dcorral dcorral force-pushed the rust-lightning-tx-persistence branch 2 times, most recently from 40b884c to 60ab584 Compare February 17, 2026 11:26
@dcorral dcorral force-pushed the rust-lightning-tx-persistence branch from 60ab584 to 8aceb21 Compare February 17, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments