-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from Lederstrumpf/state_recovery
State recovery
- Loading branch information
Showing
21 changed files
with
824 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
title State Recovery Procedure | ||
|
||
participant syncerd | ||
// TODO: remove walletd once it's stateless | ||
participant walletd | ||
participant swapd | ||
participant checkpointd | ||
participant farcasterd | ||
participant cli | ||
participant peerd | ||
|
||
== State Recovery Procedure | ||
entryspacing 0.8 | ||
farcasterd -> checkpointd : launch | ||
checkpointd -> farcasterd : RecoverableStates | ||
farcasterd -> cli : RecoverableStates | ||
cli -> farcasterd : RecoverSelectedState | ||
farcasterd -> walletd : launch | ||
farcasterd -> swapd : launch | ||
farcasterd -> syncerd : launch | ||
farcasterd -> peerd : launch | ||
walletd -> farcasterd : Ctl Hello | ||
swapd -> farcasterd : Ctl Hello | ||
syncerd -> farcasterd : Ctl Hello | ||
peerd -> farcasterd : Ctl Hello | ||
farcasterd -> checkpointd : RecoverSelectedState | ||
checkpointd -> walletd : RecoverWallet | ||
checkpointd -> peerd : RecoverPeerd | ||
checkpointd -> swapd : RecoverSwap | ||
// these tasks could be checkpointed, but can probably be recreated from scratch based on recovered state in swapd (and currently also walletd) | ||
swapd -> syncerd : WatchTasks | ||
swapd -> swapd : ResumeSwap |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// LNP Node: node running lightning network protocol and generalized lightning | ||
// channels. | ||
// Written in 2020 by | ||
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com> | ||
// | ||
// To the extent possible under law, the author(s) have dedicated all | ||
// copyright and related and neighboring rights to this software to | ||
// the public domain worldwide. This software is distributed without | ||
// any warranty. | ||
// | ||
// You should have received a copy of the MIT License | ||
// along with this software. | ||
// If not, see <https://opensource.org/licenses/MIT>. | ||
|
||
#![recursion_limit = "256"] | ||
// Coding conventions | ||
#![deny( | ||
non_upper_case_globals, | ||
non_camel_case_types, | ||
non_snake_case, | ||
unused_mut, | ||
unused_imports, | ||
dead_code, | ||
missing_docs | ||
)] | ||
|
||
//! Main executable for databased: farcaster node databaseing microservice. | ||
#[macro_use] | ||
extern crate log; | ||
|
||
use clap::Parser; | ||
|
||
use farcaster_node::databased::{self, Opts}; | ||
use farcaster_node::ServiceConfig; | ||
|
||
fn main() { | ||
let mut opts = Opts::parse(); | ||
trace!("Command-line arguments: {:?}", &opts); | ||
opts.process(); | ||
trace!("Processed arguments: {:?}", &opts); | ||
|
||
let service_config: ServiceConfig = opts.shared.clone().into(); | ||
trace!("Daemon configuration: {:#?}", &service_config); | ||
debug!("MSG RPC socket {}", &service_config.msg_endpoint); | ||
debug!("CTL RPC socket {}", &service_config.ctl_endpoint); | ||
|
||
debug!("Starting runtime ..."); | ||
databased::run(service_config, opts.shared.data_dir).expect("Error running databased runtime"); | ||
|
||
unreachable!() | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// LNP Node: node running lightning network protocol and generalized lightning | ||
// channels. | ||
// Written in 2020 by | ||
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com> | ||
// | ||
// To the extent possible under law, the author(s) have dedicated all | ||
// copyright and related and neighboring rights to this software to | ||
// the public domain worldwide. This software is distributed without | ||
// any warranty. | ||
// | ||
// You should have received a copy of the MIT License | ||
// along with this software. | ||
// If not, see <https://opensource.org/licenses/MIT>. | ||
|
||
#[cfg(feature = "shell")] | ||
mod opts; | ||
mod runtime; | ||
|
||
#[cfg(feature = "shell")] | ||
pub use opts::Opts; | ||
pub use runtime::run; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// LNP Node: node running lightning network protocol and generalized lightning | ||
// channels. | ||
// Written in 2020 by | ||
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com> | ||
// | ||
// To the extent possible under law, the author(s) have dedicated all | ||
// copyright and related and neighboring rights to this software to | ||
// the public domain worldwide. This software is distributed without | ||
// any warranty. | ||
// | ||
// You should have received a copy of the MIT License | ||
// along with this software. | ||
// If not, see <https://opensource.org/licenses/MIT>. | ||
|
||
use crate::opts::FARCASTER_KEY_FILE; | ||
use clap::{AppSettings, Parser, ValueHint}; | ||
use std::path::PathBuf; | ||
use std::{fs, io::Read}; | ||
|
||
use crate::opts::TokenString; | ||
use bitcoin::secp256k1::{ | ||
rand::{rngs::ThreadRng, thread_rng}, | ||
PublicKey, Secp256k1, SecretKey, | ||
}; | ||
use strict_encoding::{StrictDecode, StrictEncode}; | ||
|
||
/// database daemon; part of Farcaster Node | ||
#[derive(Parser, Clone, PartialEq, Eq, Debug)] | ||
#[clap(name = "databased", bin_name = "databased", author, version)] | ||
pub struct Opts { | ||
/// These params can be read also from the configuration file, not just | ||
/// command-line args or environment variables | ||
#[clap(flatten)] | ||
pub shared: crate::opts::Opts, | ||
} | ||
|
||
impl Opts { | ||
pub fn process(&mut self) { | ||
self.shared.process(); | ||
} | ||
} |
Oops, something went wrong.