Refactor the Keychain to be based on a trait (#1146)

* First pass at restructuring the keychain crate and introducing a Keychain trait
* Parameterized everything that had to. Stuff compiles.
* More stuff compiles, fix most tests
* Big merge, pushing down opening the keychain forced adding factory methods on trait
* Test fixes for pool and servers crate
This commit is contained in:
Ignotus Peverell
2018-06-08 06:21:54 +01:00
committed by GitHub
parent a6590ea0ae
commit af178f82f8
43 changed files with 840 additions and 678 deletions
+9 -8
View File
@@ -268,12 +268,13 @@ impl LocalServerContainer {
//panic!("Error initting wallet seed: {}", e);
}
let wallet = FileWallet::new(self.wallet_config.clone(), "").unwrap_or_else(|e| {
panic!(
"Error creating wallet: {:?} Config: {:?}",
e, self.wallet_config
)
});
let wallet: FileWallet<keychain::ExtKeychain> =
FileWallet::new(self.wallet_config.clone(), "").unwrap_or_else(|e| {
panic!(
"Error creating wallet: {:?} Config: {:?}",
e, self.wallet_config
)
});
wallet::controller::foreign_listener(wallet, &self.wallet_config.api_listen_addr())
.unwrap_or_else(|e| {
@@ -298,7 +299,7 @@ impl LocalServerContainer {
config: &WalletConfig,
wallet_seed: &wallet::WalletSeed,
) -> wallet::WalletInfo {
let keychain = wallet_seed
let keychain: keychain::ExtKeychain = wallet_seed
.derive_keychain("")
.expect("Failed to derive keychain from seed file and passphrase.");
let mut wallet = FileWallet::new(config.clone(), "")
@@ -321,7 +322,7 @@ impl LocalServerContainer {
let wallet_seed =
wallet::WalletSeed::from_file(config).expect("Failed to read wallet seed file.");
let keychain = wallet_seed
let keychain: keychain::ExtKeychain = wallet_seed
.derive_keychain("")
.expect("Failed to derive keychain from seed file and passphrase.");
let max_outputs = 500;