final updates for tag and build based on grin 1.1.0 merge

This commit is contained in:
Yeastplume 2019-04-03 14:22:30 +01:00
parent 0e9ccef3e5
commit 9b49bde4f9
No known key found for this signature in database
GPG key ID: AE6E005DF6E76B95
7 changed files with 228 additions and 198 deletions

366
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -31,6 +31,7 @@ uuid = { version = "0.7", features = ["serde", "v4"] }
url = "1.7.0"
chrono = { version = "0.4.4", features = ["serde"] }
easy-jsonrpc = "0.4.1"
lazy_static = "1"
grin_wallet_util = { path = "../util", version = "1.1.0" }

View file

@ -31,6 +31,7 @@ use crate::util::Mutex;
use failure::ResultExt;
use futures::future::{err, ok};
use futures::{Future, Stream};
use hyper::header::HeaderValue;
use hyper::{Body, Request, Response, StatusCode};
use serde::{Deserialize, Serialize};
use serde_json;
@ -45,6 +46,11 @@ use crate::apiwallet::{Foreign, ForeignRpc, Owner, OwnerRpc};
use easy_jsonrpc;
use easy_jsonrpc::Handler;
lazy_static! {
pub static ref GRIN_OWNER_BASIC_REALM: HeaderValue =
HeaderValue::from_str("Basic realm=GrinOwnerAPI").unwrap();
}
/// Instantiate wallet Owner API for a single-use (command line) call
/// Return a function containing a loaded API context to call
pub fn owner_single_use<F, T: ?Sized, C, K>(wallet: Arc<Mutex<T>>, f: F) -> Result<(), Error>
@ -93,8 +99,10 @@ where
if api_secret.is_some() {
let api_basic_auth =
"Basic ".to_string() + &to_base64(&("grin:".to_string() + &api_secret.unwrap()));
let basic_realm = "Basic realm=GrinOwnerAPI".to_string();
let basic_auth_middleware = Arc::new(BasicAuthMiddleware::new(api_basic_auth, basic_realm));
let basic_auth_middleware = Arc::new(BasicAuthMiddleware::new(
api_basic_auth,
&GRIN_OWNER_BASIC_REALM,
));
router.add_middleware(basic_auth_middleware);
}

View file

@ -19,6 +19,8 @@ extern crate prettytable;
#[macro_use]
extern crate log;
#[macro_use]
extern crate lazy_static;
use failure;
use grin_wallet_api as apiwallet;
use grin_wallet_config as config;

View file

@ -236,7 +236,7 @@ where
}
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = OutputData> + 'a> {
Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap())
Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap().map(|o| o.1))
}
fn get_tx_log_entry(&self, u: &Uuid) -> Result<Option<TxLogEntry>, Error> {
@ -245,7 +245,7 @@ where
}
fn tx_log_iter<'a>(&'a self) -> Box<dyn Iterator<Item = TxLogEntry> + 'a> {
Box::new(self.db.iter(&[TX_LOG_ENTRY_PREFIX]).unwrap())
Box::new(self.db.iter(&[TX_LOG_ENTRY_PREFIX]).unwrap().map(|o| o.1))
}
fn get_private_context(&mut self, slate_id: &[u8]) -> Result<Context, Error> {
@ -266,7 +266,12 @@ where
}
fn acct_path_iter<'a>(&'a self) -> Box<dyn Iterator<Item = AcctPathMapping> + 'a> {
Box::new(self.db.iter(&[ACCOUNT_PATH_MAPPING_PREFIX]).unwrap())
Box::new(
self.db
.iter(&[ACCOUNT_PATH_MAPPING_PREFIX])
.unwrap()
.map(|o| o.1),
)
}
fn get_acct_path(&self, label: String) -> Result<Option<AcctPathMapping>, Error> {
@ -412,7 +417,8 @@ where
.as_ref()
.unwrap()
.iter(&[OUTPUT_PREFIX])
.unwrap(),
.unwrap()
.map(|o| o.1),
)
}
@ -450,7 +456,8 @@ where
.as_ref()
.unwrap()
.iter(&[TX_LOG_ENTRY_PREFIX])
.unwrap(),
.unwrap()
.map(|o| o.1),
)
}
@ -519,7 +526,8 @@ where
.as_ref()
.unwrap()
.iter(&[ACCOUNT_PATH_MAPPING_PREFIX])
.unwrap(),
.unwrap()
.map(|o| o.1),
)
}

View file

@ -70,7 +70,7 @@ fn get_outputs_by_pmmr_index_local(
outputs: outputs
.2
.iter()
.map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true))
.map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true).unwrap())
.collect(),
}
}
@ -78,7 +78,7 @@ fn get_outputs_by_pmmr_index_local(
/// Adds a block with a given reward to the chain and mines it
pub fn add_block_with_reward(chain: &Chain, txs: Vec<&Transaction>, reward: CbData) {
let prev = chain.head_header().unwrap();
let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter());
let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter().unwrap());
let mut b = core::core::Block::new(
&prev,
txs.into_iter().cloned().collect(),

View file

@ -16,12 +16,21 @@ serde_derive = "1"
toml = "0.4"
dirs = "1.0.3"
grin_core = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
grin_util = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
grin_api = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
grin_store = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
# For Release
grin_core = "1.1.0-beta.1"
grin_keychain = "1.1.0-beta.1"
grin_chain = "1.1.0-beta.1"
grin_util = "1.1.0-beta.1"
grin_api = "1.1.0-beta.1"
grin_store = "1.1.0-beta.1"
# For bleeding edge
#grin_core = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
#grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
#grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
#grin_util = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
#grin_api = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
#grin_store = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
# For local testing
#grin_core = { path = "../../grin/core", version= "1.1.0"}