Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Move db.rs into server crates #4567

Merged
merged 4 commits into from
Mar 18, 2024

Conversation

m1sterc001guy
Copy link
Contributor

There is no reason for db.rs to be in the common crates, since the client and server databases are separate and don't store the same things.

This PR moves db.rs for each of the modules into the server crates from common.

@dpc
Copy link
Contributor

dpc commented Mar 15, 2024

Why do we need ln snapshot regenerated? Seems :sus:

@m1sterc001guy
Copy link
Contributor Author

Why do we need ln snapshot regenerated? Seems :sus:

Because the ln client previously re-used the LightningGateway key from the server code. I shouldn't have done it that way, but it was available and was convenient to re-use code. Now that the struct exists on the client side, this PR adds the record to the backup.

@dpc
Copy link
Contributor

dpc commented Mar 18, 2024

Because the ln client previously re-used the LightningGateway key from the server code. I shouldn't have done it that way, but it was available and was convenient to re-use code. Now that the struct exists on the client side, this PR adds the record to the backup.

Do we need a migration?

Copy link
Contributor

@dpc dpc left a comment

Choose a reason for hiding this comment

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

LGTM, but do we need a migration?

@m1sterc001guy
Copy link
Contributor Author

Do we need a migration?

Nope, its the same prefix and the same struct.

Comment on lines +917 to +929
fedimint_ln_client::db::DbKeyPrefix::LightningGateway => {
let gateways = dbtx
.find_by_prefix(&LightningGatewayKeyPrefix)
.await
.collect::<Vec<_>>()
.await;
let num_gateways = gateways.len();
ensure!(
num_gateways > 0,
"validate_migrations was not able to read any LightningGateways"
);
info!("Validated LightningGateways");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is why the DB snapshot needed to be regenerated. Before the test was just missing.

@elsirion elsirion added this pull request to the merge queue Mar 18, 2024
Merged via the queue into fedimint:master with commit a83ef8c Mar 18, 2024
20 checks passed
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.

None yet

3 participants