-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: add backup daemon #1032
feat: add backup daemon #1032
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed through the code. Agree on the high level concept. Nice to see this is progressing well.
Correct, since it can be restored using lnd/raiden directly. As far as I see it we'd have to implement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good conceptually.
1af6c81
to
e50a079
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments/questions above. As a general style nit I noticed a lot of blank lines which is not consistent with the rest of the codebase. I think our tslint
settings even display a warning/suggestion against those?
e50a079
to
bfbf6d7
Compare
@erkarl regarding the style: you are right about the inconsistencies with the rest of the codebase but I didn't think that it mattered that much when actually writing the code since some other files also have some blank lines. And What do you think? Should I remove some blank lines or it is fine to leave it as is? |
Just leave it as is for now. I'll take a look at our linter configuration at some point and unify the formatting style. |
Added |
Todo's need to be updated as per #917 |
58d1ade
to
9f75a56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filewatcher approach is nice!
Cosmetics:
Can we rename xu-backup
-> xud-backup
?
9f75a56
to
d9c4a02
Compare
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor nits/suggestions, otherwise looks very nice. I haven't tested it manually yet but I can run it tomorrow.
let's definitely do some manual testing @sangaman @erkarl @michael1011 |
d9c4a02
to
1cd7476
Compare
bin/xud-backup
Outdated
describe: 'Port for the lnd gRPC interface', | ||
type: 'number', | ||
}, | ||
'raiden.database': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raiden.dbpath
perhaps? Also would it make sense to add this property to Config.ts
and RaidenClientConfig
so it can be assigned a default value and get added automatically to the sample config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't do that initially because the path to the database of raiden depends not only on the network it is running on but also on a node specific id and looks like this: exchange/node_1a8e5ab4/netid_4321/network_de8a2bdd/v23_log.db
.
Any ideas on how to determine a reasonable default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think raiden.dbpath
could be the only value where we don't specify a default value. Thoughts @sangaman?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, that makes sense. We can just leave this out then and not have a default value.
1cd7476
to
e193697
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing the debug statements for when lnd channel backups are written - it should happen after swaps occur right? I tested with a BTC-LTC swap and I did see this.
24/10/2019 13:33:24.758 [BACKUP] verbose: Writing initial BTC LND channel backup
24/10/2019 13:33:24.769 [BACKUP] verbose: Listening to BTC LND channel backups
24/10/2019 13:33:24.778 [BACKUP] verbose: Writing initial LTC LND channel backup
24/10/2019 13:33:24.784 [BACKUP] verbose: Listening to LTC LND channel backups
One more suggestion is that it would be nice to be able to specify a path to the config file when it's not in the default location, which we could do using the --xudir
option (the Config module looks for the config file in the xudir directory).
Lastly I'm also thinking it would be nice if on the first writes, it logs where it's saving the backup to, like Writing initial xud database backup to [path]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing the debug statements for when lnd channel backups are written - it should happen after swaps occur right? I tested with a BTC-LTC swap and I did see this.
24/10/2019 13:33:24.758 [BACKUP] verbose: Writing initial BTC LND channel backup
24/10/2019 13:33:24.769 [BACKUP] verbose: Listening to BTC LND channel backups
24/10/2019 13:33:24.778 [BACKUP] verbose: Writing initial LTC LND channel backup
24/10/2019 13:33:24.784 [BACKUP] verbose: Listening to LTC LND channel backups
One more suggestion is that it would be nice to be able to specify a path to the config file when it's not in the default location, which we could do using the --xudir
option (the Config module looks for the config file in the xudir directory).
Lastly I'm also thinking it would be nice if on the first writes, it logs where it's saving the backup to, like Writing initial xud database backup to [path]
.
I am not backing up the database of LND but the SCBs (static channel backups). These backups are done once for a channel and are therefore static. This also means that a new backup will be done once you close an existing or open a new channel. When you do that it should print you a debug statement @sangaman |
0275ed4
to
2ca28ea
Compare
The tests fail only on Travis and because of this error:
It is an bug of one of the dependencies of Jest (jestjs/jest#9062) and was fixed recently. What should be done about this? Wait for the next Jest release and continue working on the restore in this branch or should we update the dependency in @sangaman @erkarl |
Hmmm, it looks like jest doesn't release very often unfortunately. I think I'm fine with either approach, if you want to update the Another option would be to split the test case out of the commit, merge this without the test case, and then open a separate PR for the test case and merge that (along with a jest dependency update) once there's a new jest release. That actually might be my preferred approach. |
2ca28ea
to
c32e804
Compare
Closes #917
This PR adds
xu-backup
that starts listening for new LND SCBs and writing them to the disk when executed.I am not finished yet and have some things to do before this backup daemon can be used but please have a look at this PR nevertheless to acknowledge the concept and give me some feedback on what I have been doing in this branch.
Todo:
@kilrau we agreed on not implementing a restoring feature for now, right?