Skip to content

feat: use ChannelDb for channel persistence#14355

Merged
zerosnacks merged 8 commits intofoundry-rs:masterfrom
stevencartavia:use-channel-db
Apr 22, 2026
Merged

feat: use ChannelDb for channel persistence#14355
zerosnacks merged 8 commits intofoundry-rs:masterfrom
stevencartavia:use-channel-db

Conversation

@stevencartavia
Copy link
Copy Markdown
Collaborator

@stevencartavia stevencartavia commented Apr 16, 2026

  • Replace JSON file persistence (~/.tempo/foundry/channels.json) with SQLite via foundry_wallets::ChannelDb (~/.tempo/channels.db)
  • Bump foundry-wallets rev to e8c8be1 (includes foundry-core#17)
  • Update CI script to query SQLite instead of grepping JSON

@stevencartavia stevencartavia changed the title feat: use mpp-rs ChannelDb for channel persistence feat: useChannelDb for channel persistence Apr 20, 2026
Amp-Thread-ID: https://ampcode.com/threads/T-019db125-564b-72b8-ab3d-6f780aa89ff4
Co-authored-by: Amp <amp@ampcode.com>

# Conflicts:
#	Cargo.lock
@stevencartavia stevencartavia marked this pull request as ready for review April 21, 2026 18:58
@stevencartavia stevencartavia changed the title feat: useChannelDb for channel persistence feat: use ChannelDb for channel persistence Apr 21, 2026
Comment thread crates/common/src/provider/mpp/persist.rs Outdated
} else {
channels
.insert(key.to_string(), PersistedChannel::from_channel_entry(entry, deposit, origin));
warn!(key, "upsert_channel_in_memory called for unknown channel");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May this have side-effect, do we always match existing channel ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else branch is unreachable in practice, upsert_channel_in_memory() is only called from the voucher path (session.rs:689) which always operates on an already-open channel. The warn! makes it defensive instead of silently inserting incomplete data.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay nice, ty for clarification

@zerosnacks zerosnacks requested a review from mablr April 22, 2026 09:14
Copy link
Copy Markdown
Collaborator

@mablr mablr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm

@zerosnacks zerosnacks enabled auto-merge (squash) April 22, 2026 10:35
@zerosnacks zerosnacks merged commit e8a6f47 into foundry-rs:master Apr 22, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants