Cleanup a bunch of build warnings

This commit is contained in:
Ignotus Peverell 2018-07-02 00:23:24 +01:00
parent 2d4236f75b
commit 1a410f115c
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211
16 changed files with 22 additions and 51 deletions

View file

@ -524,8 +524,6 @@ impl Chain {
pub fn txhashset_write<T>(
&self,
h: Hash,
rewind_to_output: u64,
rewind_to_kernel: u64,
txhashset_data: File,
status: &T,
) -> Result<(), Error>

View file

@ -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.

View file

@ -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<TxHashSetArchive, ser::Error> {
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,
})
}

View file

@ -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,
)

View file

@ -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,
) {

View file

@ -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,
);

View file

@ -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 {

View file

@ -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;

View file

@ -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 {

View file

@ -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,
};

View file

@ -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<K: Keychain> = for<'a> Fn(&'a mut Context<K>, (Transaction, TxKernel, BlindSum))
pub type Append<K> = for<'a> Fn(&'a mut Context<K>, (Transaction, TxKernel, BlindSum))
-> (Transaction, TxKernel, BlindSum);
/// Adds an input with the provided value and blinding key to the transaction

View file

@ -139,6 +139,7 @@ where
T: WalletBackend<K> + WalletClient,
K: Keychain,
{
/// Create a new owner API handler for GET methods
pub fn new(wallet: Arc<Mutex<T>>) -> OwnerAPIGetHandler<T, K> {
OwnerAPIGetHandler {
wallet,
@ -176,7 +177,7 @@ where
fn node_height(
&self,
req: &mut Request,
_req: &mut Request,
api: &mut APIOwner<T, K>,
) -> Result<(u64, bool), Error> {
api.node_height()
@ -230,6 +231,7 @@ where
}
}
/// Handles all owner API POST requests
pub struct OwnerAPIPostHandler<T, K>
where
T: WalletBackend<K>,
@ -245,6 +247,7 @@ where
T: WalletBackend<K> + WalletClient,
K: Keychain,
{
/// New POST handler
pub fn new(wallet: Arc<Mutex<T>>) -> OwnerAPIPostHandler<T, K> {
OwnerAPIPostHandler {
wallet,
@ -278,7 +281,7 @@ where
}
}
fn issue_burn_tx(&self, req: &mut Request, api: &mut APIOwner<T, K>) -> Result<(), Error> {
fn issue_burn_tx(&self, _req: &mut Request, api: &mut APIOwner<T, K>) -> Result<(), Error> {
// TODO: Args
api.issue_burn_tx(60, 10, 1000)
}

View file

@ -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()

View file

@ -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(())
};

View file

@ -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()?;
}

View file

@ -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<store::Error> for Error {
fn from(error: store::Error) -> Error {
Error::from((ErrorKind::Backend(format!("{:?}", error))))
Error::from(ErrorKind::Backend(format!("{:?}", error)))
}
}