diff --git a/chain/src/chain.rs b/chain/src/chain.rs index e0771bff1..984792c5b 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -524,8 +524,6 @@ impl Chain { pub fn txhashset_write( &self, h: Hash, - rewind_to_output: u64, - rewind_to_kernel: u64, txhashset_data: File, status: &T, ) -> Result<(), Error> diff --git a/core/src/pow/mod.rs b/core/src/pow/mod.rs index 4bdab40e5..c1c1ffaec 100644 --- a/core/src/pow/mod.rs +++ b/core/src/pow/mod.rs @@ -44,7 +44,6 @@ use core::{Block, BlockHeader}; use genesis; use global; use pow::cuckoo::{Cuckoo, Error}; -use ser; /// Validates the proof of work of a given header, and that the proof of work /// satisfies the requirements of the header. diff --git a/p2p/src/msg.rs b/p2p/src/msg.rs index bdcd4ae87..32752ff6c 100644 --- a/p2p/src/msg.rs +++ b/p2p/src/msg.rs @@ -736,10 +736,6 @@ pub struct TxHashSetArchive { pub hash: Hash, /// Height of the corresponding block pub height: u64, - /// Output tree index the receiver should rewind to - pub rewind_to_output: u64, - /// Kernel tree index the receiver should rewind to - pub rewind_to_kernel: u64, /// Size in bytes of the archive pub bytes: u64, } @@ -750,8 +746,6 @@ impl Writeable for TxHashSetArchive { ser_multiwrite!( writer, [write_u64, self.height], - [write_u64, self.rewind_to_output], - [write_u64, self.rewind_to_kernel], [write_u64, self.bytes] ); Ok(()) @@ -761,14 +755,11 @@ impl Writeable for TxHashSetArchive { impl Readable for TxHashSetArchive { fn read(reader: &mut Reader) -> Result { let hash = Hash::read(reader)?; - let (height, rewind_to_output, rewind_to_kernel, bytes) = - ser_multiread!(reader, read_u64, read_u64, read_u64, read_u64); + let (height, bytes) = ser_multiread!(reader, read_u64, read_u64); Ok(TxHashSetArchive { hash, height, - rewind_to_output, - rewind_to_kernel, bytes, }) } diff --git a/p2p/src/peer.rs b/p2p/src/peer.rs index 6bdab1755..4de79322e 100644 --- a/p2p/src/peer.rs +++ b/p2p/src/peer.rs @@ -431,15 +431,11 @@ impl ChainAdapter for TrackingAdapter { fn txhashset_write( &self, h: Hash, - rewind_to_output: u64, - rewind_to_kernel: u64, txhashset_data: File, peer_addr: SocketAddr, ) -> bool { self.adapter.txhashset_write( h, - rewind_to_output, - rewind_to_kernel, txhashset_data, peer_addr, ) diff --git a/p2p/src/peers.rs b/p2p/src/peers.rs index 77001fcd1..fa1c730a9 100644 --- a/p2p/src/peers.rs +++ b/p2p/src/peers.rs @@ -614,15 +614,11 @@ impl ChainAdapter for Peers { fn txhashset_write( &self, h: Hash, - rewind_to_output: u64, - rewind_to_kernel: u64, txhashset_data: File, peer_addr: SocketAddr, ) -> bool { if !self.adapter.txhashset_write( h, - rewind_to_output, - rewind_to_kernel, txhashset_data, peer_addr, ) { diff --git a/p2p/src/protocol.rs b/p2p/src/protocol.rs index 8bbf1a55f..7099f63e7 100644 --- a/p2p/src/protocol.rs +++ b/p2p/src/protocol.rs @@ -215,8 +215,6 @@ impl MessageHandler for Protocol { &TxHashSetArchive { height: sm_req.height as u64, hash: sm_req.hash, - rewind_to_output: txhashset.output_index, - rewind_to_kernel: txhashset.kernel_index, bytes: file_sz, }, ); @@ -231,11 +229,9 @@ impl MessageHandler for Protocol { let sm_arch: TxHashSetArchive = msg.body()?; debug!( LOGGER, - "handle_payload: txhashset archive for {} at {} rewind to {}/{}", + "handle_payload: txhashset archive for {} at {}", sm_arch.hash, sm_arch.height, - sm_arch.rewind_to_output, - sm_arch.rewind_to_kernel ); let mut tmp = env::temp_dir(); @@ -249,8 +245,6 @@ impl MessageHandler for Protocol { let tmp_zip = File::open(tmp)?; self.adapter.txhashset_write( sm_arch.hash, - sm_arch.rewind_to_output, - sm_arch.rewind_to_kernel, tmp_zip, self.addr, ); diff --git a/p2p/src/serv.rs b/p2p/src/serv.rs index e4eb27ead..ca3914544 100644 --- a/p2p/src/serv.rs +++ b/p2p/src/serv.rs @@ -253,8 +253,6 @@ impl ChainAdapter for DummyAdapter { fn txhashset_write( &self, _h: Hash, - _rewind_to_output: u64, - _rewind_to_kernel: u64, _txhashset_data: File, _peer_addr: SocketAddr, ) -> bool { diff --git a/p2p/src/types.rs b/p2p/src/types.rs index 41e99196d..5d9f7a968 100644 --- a/p2p/src/types.rs +++ b/p2p/src/types.rs @@ -263,8 +263,6 @@ pub trait ChainAdapter: Sync + Send { fn txhashset_write( &self, h: Hash, - rewind_to_output: u64, - rewind_to_kernel: u64, txhashset_data: File, peer_addr: SocketAddr, ) -> bool; diff --git a/servers/src/common/adapters.rs b/servers/src/common/adapters.rs index ac7c6a126..d90fe141e 100644 --- a/servers/src/common/adapters.rs +++ b/servers/src/common/adapters.rs @@ -327,13 +327,12 @@ impl p2p::ChainAdapter for NetToChainAdapter { fn txhashset_write( &self, h: Hash, - rewind_to_output: u64, - rewind_to_kernel: u64, txhashset_data: File, _peer_addr: SocketAddr, ) -> bool { // TODO check whether we should accept any txhashset now if let Err(e) = +<<<<<<< HEAD w(&self.chain).txhashset_write( h, rewind_to_output, @@ -341,6 +340,10 @@ impl p2p::ChainAdapter for NetToChainAdapter { txhashset_data, self.sync_state.as_ref(), ) { +======= + w(&self.chain).txhashset_write(h, txhashset_data) + { +>>>>>>> Cleanup a bunch of build warnings error!(LOGGER, "Failed to save txhashset archive: {}", e); !e.is_bad_data() } else { diff --git a/wallet/src/file_wallet.rs b/wallet/src/file_wallet.rs index 6bde8fb4e..02cba82b6 100644 --- a/wallet/src/file_wallet.rs +++ b/wallet/src/file_wallet.rs @@ -35,7 +35,7 @@ use libtx::slate::Slate; use libwallet; use libwallet::types::{ - BlockFees, BlockIdentifier, CbData, OutputData, TxWrapper, WalletBackend, + BlockFees, CbData, OutputData, TxWrapper, WalletBackend, WalletClient, WalletDetails, WalletOutputBatch, }; diff --git a/wallet/src/libtx/build.rs b/wallet/src/libtx/build.rs index 1aa4cb1b8..01f424039 100644 --- a/wallet/src/libtx/build.rs +++ b/wallet/src/libtx/build.rs @@ -27,7 +27,6 @@ use util::{kernel_sig_msg, secp}; -use core::core::hash::Hash; use core::core::{Input, Output, OutputFeatures, Transaction, TxKernel}; use keychain::{self, BlindSum, BlindingFactor, Identifier, Keychain}; use libtx::{aggsig, proof}; @@ -43,7 +42,7 @@ where /// Function type returned by the transaction combinators. Transforms a /// (Transaction, BlindSum) pair into another, provided some context. -pub type Append = for<'a> Fn(&'a mut Context, (Transaction, TxKernel, BlindSum)) +pub type Append = for<'a> Fn(&'a mut Context, (Transaction, TxKernel, BlindSum)) -> (Transaction, TxKernel, BlindSum); /// Adds an input with the provided value and blinding key to the transaction diff --git a/wallet/src/libwallet/controller.rs b/wallet/src/libwallet/controller.rs index 61413ba5d..74f0a8a83 100644 --- a/wallet/src/libwallet/controller.rs +++ b/wallet/src/libwallet/controller.rs @@ -139,6 +139,7 @@ where T: WalletBackend + WalletClient, K: Keychain, { + /// Create a new owner API handler for GET methods pub fn new(wallet: Arc>) -> OwnerAPIGetHandler { OwnerAPIGetHandler { wallet, @@ -176,7 +177,7 @@ where fn node_height( &self, - req: &mut Request, + _req: &mut Request, api: &mut APIOwner, ) -> Result<(u64, bool), Error> { api.node_height() @@ -230,6 +231,7 @@ where } } +/// Handles all owner API POST requests pub struct OwnerAPIPostHandler where T: WalletBackend, @@ -245,6 +247,7 @@ where T: WalletBackend + WalletClient, K: Keychain, { + /// New POST handler pub fn new(wallet: Arc>) -> OwnerAPIPostHandler { OwnerAPIPostHandler { wallet, @@ -278,7 +281,7 @@ where } } - fn issue_burn_tx(&self, req: &mut Request, api: &mut APIOwner) -> Result<(), Error> { + fn issue_burn_tx(&self, _req: &mut Request, api: &mut APIOwner) -> Result<(), Error> { // TODO: Args api.issue_burn_tx(60, 10, 1000) } diff --git a/wallet/src/libwallet/internal/restore.rs b/wallet/src/libwallet/internal/restore.rs index 6f7265ecf..57fd58481 100644 --- a/wallet/src/libwallet/internal/restore.rs +++ b/wallet/src/libwallet/internal/restore.rs @@ -73,8 +73,6 @@ where "Output found: {:?}, amount: {:?}", commit, info.value ); - let commit_str = util::to_hex(commit.as_ref().to_vec()); - let height = current_chain_height; let lock_height = if *is_coinbase { height + global::coinbase_maturity() diff --git a/wallet/src/libwallet/internal/selection.rs b/wallet/src/libwallet/internal/selection.rs index c3e855209..3ccd8e35d 100644 --- a/wallet/src/libwallet/internal/selection.rs +++ b/wallet/src/libwallet/internal/selection.rs @@ -94,7 +94,7 @@ where let mut batch = wallet.batch()?; for id in lock_inputs { let mut coin = batch.get(&id).unwrap(); - batch.lock_output(&mut coin); + batch.lock_output(&mut coin)?; } // write the output representing our change if let Some(d) = change_derivation { @@ -109,7 +109,7 @@ where height: current_height, lock_height: 0, is_coinbase: false, - }); + })?; } batch.commit()?; Ok(()) @@ -172,7 +172,7 @@ where height: height, lock_height: 0, is_coinbase: false, - }); + })?; batch.commit()?; Ok(()) }; diff --git a/wallet/src/libwallet/internal/updater.rs b/wallet/src/libwallet/internal/updater.rs index 86f831aff..ae2f6a84e 100644 --- a/wallet/src/libwallet/internal/updater.rs +++ b/wallet/src/libwallet/internal/updater.rs @@ -160,7 +160,7 @@ where } let mut batch = wallet.batch()?; for id in ids_to_del { - batch.delete(&id); + batch.delete(&id)?; } batch.commit()?; Ok(()) @@ -265,7 +265,7 @@ where height: height, lock_height: lock_height, is_coinbase: true, - }); + })?; batch.commit()?; } diff --git a/wallet/src/lmdb_wallet.rs b/wallet/src/lmdb_wallet.rs index 6122a4772..09c1b2991 100644 --- a/wallet/src/lmdb_wallet.rs +++ b/wallet/src/lmdb_wallet.rs @@ -14,15 +14,13 @@ use std::cell::RefCell; use std::collections::HashMap; -use std::collections::hash_map::Values; -use std::ops::Deref; use std::sync::Arc; use std::{fs, path}; -use failure::{Context, ResultExt}; +use failure::ResultExt; use keychain::{Identifier, Keychain}; -use store::{self, option_to_not_found, to_key, u64_to_key}; +use store::{self, option_to_not_found, to_key}; use client; use libtx::slate::Slate; @@ -38,7 +36,7 @@ const DERIV_PREFIX: u8 = 'd' as u8; impl From for Error { fn from(error: store::Error) -> Error { - Error::from((ErrorKind::Backend(format!("{:?}", error)))) + Error::from(ErrorKind::Backend(format!("{:?}", error))) } }