V2 Slate Compatibility (#272)

* re-insert v2 slate

* reinstate version conversions

* rustfmt

* add and test versioning checks against 2.0.0 wallets

* rustfmt

* fix to invoice file output

* doctest fix

* remove target slate version from command line options
This commit is contained in:
Yeastplume
2019-12-04 11:52:42 +00:00
committed by GitHub
parent 7db55592d0
commit 86e6f511c3
10 changed files with 591 additions and 54 deletions
+1 -3
View File
@@ -513,9 +513,7 @@ where
{
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
let slate = api.issue_invoice_tx(m, args.issue_args)?;
let mut tx_file = File::create(args.dest.clone())?;
tx_file.write_all(json::to_string(&slate).unwrap().as_bytes())?;
tx_file.sync_all()?;
PathToSlate((&args.dest).into()).put_tx(&slate)?;
Ok(())
})?;
Ok(())
+2 -5
View File
@@ -19,7 +19,7 @@ use crate::config::TorConfig;
use crate::keychain::Keychain;
use crate::libwallet::{
address, Error, ErrorKind, NodeClient, NodeVersionInfo, Slate, WalletInst, WalletLCProvider,
CURRENT_SLATE_VERSION, GRIN_BLOCK_HEADER_VERSION,
GRIN_BLOCK_HEADER_VERSION,
};
use crate::util::secp::key::SecretKey;
use crate::util::{from_hex, static_secp_instance, to_base64, Mutex};
@@ -63,10 +63,7 @@ fn check_middleware(
bhv = n.block_header_version;
}
if let Some(s) = slate {
if s.version_info.version < CURRENT_SLATE_VERSION
// || (bhv == 3 && s.version_info.block_header_version != 3)
|| (bhv > 3 && s.version_info.block_header_version < GRIN_BLOCK_HEADER_VERSION)
{
if bhv > 3 && s.version_info.block_header_version < GRIN_BLOCK_HEADER_VERSION {
Err(ErrorKind::Compatibility(
"Incoming Slate is not compatible with this wallet. \
Please upgrade the node or use a different one."