mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
Cleanup a bunch of build warnings
This commit is contained in:
parent
2d4236f75b
commit
1a410f115c
16 changed files with 22 additions and 51 deletions
|
@ -524,8 +524,6 @@ impl Chain {
|
||||||
pub fn txhashset_write<T>(
|
pub fn txhashset_write<T>(
|
||||||
&self,
|
&self,
|
||||||
h: Hash,
|
h: Hash,
|
||||||
rewind_to_output: u64,
|
|
||||||
rewind_to_kernel: u64,
|
|
||||||
txhashset_data: File,
|
txhashset_data: File,
|
||||||
status: &T,
|
status: &T,
|
||||||
) -> Result<(), Error>
|
) -> Result<(), Error>
|
||||||
|
|
|
@ -44,7 +44,6 @@ use core::{Block, BlockHeader};
|
||||||
use genesis;
|
use genesis;
|
||||||
use global;
|
use global;
|
||||||
use pow::cuckoo::{Cuckoo, Error};
|
use pow::cuckoo::{Cuckoo, Error};
|
||||||
use ser;
|
|
||||||
|
|
||||||
/// Validates the proof of work of a given header, and that the proof of work
|
/// Validates the proof of work of a given header, and that the proof of work
|
||||||
/// satisfies the requirements of the header.
|
/// satisfies the requirements of the header.
|
||||||
|
|
|
@ -736,10 +736,6 @@ pub struct TxHashSetArchive {
|
||||||
pub hash: Hash,
|
pub hash: Hash,
|
||||||
/// Height of the corresponding block
|
/// Height of the corresponding block
|
||||||
pub height: u64,
|
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
|
/// Size in bytes of the archive
|
||||||
pub bytes: u64,
|
pub bytes: u64,
|
||||||
}
|
}
|
||||||
|
@ -750,8 +746,6 @@ impl Writeable for TxHashSetArchive {
|
||||||
ser_multiwrite!(
|
ser_multiwrite!(
|
||||||
writer,
|
writer,
|
||||||
[write_u64, self.height],
|
[write_u64, self.height],
|
||||||
[write_u64, self.rewind_to_output],
|
|
||||||
[write_u64, self.rewind_to_kernel],
|
|
||||||
[write_u64, self.bytes]
|
[write_u64, self.bytes]
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -761,14 +755,11 @@ impl Writeable for TxHashSetArchive {
|
||||||
impl Readable for TxHashSetArchive {
|
impl Readable for TxHashSetArchive {
|
||||||
fn read(reader: &mut Reader) -> Result<TxHashSetArchive, ser::Error> {
|
fn read(reader: &mut Reader) -> Result<TxHashSetArchive, ser::Error> {
|
||||||
let hash = Hash::read(reader)?;
|
let hash = Hash::read(reader)?;
|
||||||
let (height, rewind_to_output, rewind_to_kernel, bytes) =
|
let (height, bytes) = ser_multiread!(reader, read_u64, read_u64);
|
||||||
ser_multiread!(reader, read_u64, read_u64, read_u64, read_u64);
|
|
||||||
|
|
||||||
Ok(TxHashSetArchive {
|
Ok(TxHashSetArchive {
|
||||||
hash,
|
hash,
|
||||||
height,
|
height,
|
||||||
rewind_to_output,
|
|
||||||
rewind_to_kernel,
|
|
||||||
bytes,
|
bytes,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,15 +431,11 @@ impl ChainAdapter for TrackingAdapter {
|
||||||
fn txhashset_write(
|
fn txhashset_write(
|
||||||
&self,
|
&self,
|
||||||
h: Hash,
|
h: Hash,
|
||||||
rewind_to_output: u64,
|
|
||||||
rewind_to_kernel: u64,
|
|
||||||
txhashset_data: File,
|
txhashset_data: File,
|
||||||
peer_addr: SocketAddr,
|
peer_addr: SocketAddr,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
self.adapter.txhashset_write(
|
self.adapter.txhashset_write(
|
||||||
h,
|
h,
|
||||||
rewind_to_output,
|
|
||||||
rewind_to_kernel,
|
|
||||||
txhashset_data,
|
txhashset_data,
|
||||||
peer_addr,
|
peer_addr,
|
||||||
)
|
)
|
||||||
|
|
|
@ -614,15 +614,11 @@ impl ChainAdapter for Peers {
|
||||||
fn txhashset_write(
|
fn txhashset_write(
|
||||||
&self,
|
&self,
|
||||||
h: Hash,
|
h: Hash,
|
||||||
rewind_to_output: u64,
|
|
||||||
rewind_to_kernel: u64,
|
|
||||||
txhashset_data: File,
|
txhashset_data: File,
|
||||||
peer_addr: SocketAddr,
|
peer_addr: SocketAddr,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
if !self.adapter.txhashset_write(
|
if !self.adapter.txhashset_write(
|
||||||
h,
|
h,
|
||||||
rewind_to_output,
|
|
||||||
rewind_to_kernel,
|
|
||||||
txhashset_data,
|
txhashset_data,
|
||||||
peer_addr,
|
peer_addr,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -215,8 +215,6 @@ impl MessageHandler for Protocol {
|
||||||
&TxHashSetArchive {
|
&TxHashSetArchive {
|
||||||
height: sm_req.height as u64,
|
height: sm_req.height as u64,
|
||||||
hash: sm_req.hash,
|
hash: sm_req.hash,
|
||||||
rewind_to_output: txhashset.output_index,
|
|
||||||
rewind_to_kernel: txhashset.kernel_index,
|
|
||||||
bytes: file_sz,
|
bytes: file_sz,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -231,11 +229,9 @@ impl MessageHandler for Protocol {
|
||||||
let sm_arch: TxHashSetArchive = msg.body()?;
|
let sm_arch: TxHashSetArchive = msg.body()?;
|
||||||
debug!(
|
debug!(
|
||||||
LOGGER,
|
LOGGER,
|
||||||
"handle_payload: txhashset archive for {} at {} rewind to {}/{}",
|
"handle_payload: txhashset archive for {} at {}",
|
||||||
sm_arch.hash,
|
sm_arch.hash,
|
||||||
sm_arch.height,
|
sm_arch.height,
|
||||||
sm_arch.rewind_to_output,
|
|
||||||
sm_arch.rewind_to_kernel
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut tmp = env::temp_dir();
|
let mut tmp = env::temp_dir();
|
||||||
|
@ -249,8 +245,6 @@ impl MessageHandler for Protocol {
|
||||||
let tmp_zip = File::open(tmp)?;
|
let tmp_zip = File::open(tmp)?;
|
||||||
self.adapter.txhashset_write(
|
self.adapter.txhashset_write(
|
||||||
sm_arch.hash,
|
sm_arch.hash,
|
||||||
sm_arch.rewind_to_output,
|
|
||||||
sm_arch.rewind_to_kernel,
|
|
||||||
tmp_zip,
|
tmp_zip,
|
||||||
self.addr,
|
self.addr,
|
||||||
);
|
);
|
||||||
|
|
|
@ -253,8 +253,6 @@ impl ChainAdapter for DummyAdapter {
|
||||||
fn txhashset_write(
|
fn txhashset_write(
|
||||||
&self,
|
&self,
|
||||||
_h: Hash,
|
_h: Hash,
|
||||||
_rewind_to_output: u64,
|
|
||||||
_rewind_to_kernel: u64,
|
|
||||||
_txhashset_data: File,
|
_txhashset_data: File,
|
||||||
_peer_addr: SocketAddr,
|
_peer_addr: SocketAddr,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
|
|
@ -263,8 +263,6 @@ pub trait ChainAdapter: Sync + Send {
|
||||||
fn txhashset_write(
|
fn txhashset_write(
|
||||||
&self,
|
&self,
|
||||||
h: Hash,
|
h: Hash,
|
||||||
rewind_to_output: u64,
|
|
||||||
rewind_to_kernel: u64,
|
|
||||||
txhashset_data: File,
|
txhashset_data: File,
|
||||||
peer_addr: SocketAddr,
|
peer_addr: SocketAddr,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
|
@ -327,13 +327,12 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
fn txhashset_write(
|
fn txhashset_write(
|
||||||
&self,
|
&self,
|
||||||
h: Hash,
|
h: Hash,
|
||||||
rewind_to_output: u64,
|
|
||||||
rewind_to_kernel: u64,
|
|
||||||
txhashset_data: File,
|
txhashset_data: File,
|
||||||
_peer_addr: SocketAddr,
|
_peer_addr: SocketAddr,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// TODO check whether we should accept any txhashset now
|
// TODO check whether we should accept any txhashset now
|
||||||
if let Err(e) =
|
if let Err(e) =
|
||||||
|
<<<<<<< HEAD
|
||||||
w(&self.chain).txhashset_write(
|
w(&self.chain).txhashset_write(
|
||||||
h,
|
h,
|
||||||
rewind_to_output,
|
rewind_to_output,
|
||||||
|
@ -341,6 +340,10 @@ impl p2p::ChainAdapter for NetToChainAdapter {
|
||||||
txhashset_data,
|
txhashset_data,
|
||||||
self.sync_state.as_ref(),
|
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);
|
error!(LOGGER, "Failed to save txhashset archive: {}", e);
|
||||||
!e.is_bad_data()
|
!e.is_bad_data()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -35,7 +35,7 @@ use libtx::slate::Slate;
|
||||||
use libwallet;
|
use libwallet;
|
||||||
|
|
||||||
use libwallet::types::{
|
use libwallet::types::{
|
||||||
BlockFees, BlockIdentifier, CbData, OutputData, TxWrapper, WalletBackend,
|
BlockFees, CbData, OutputData, TxWrapper, WalletBackend,
|
||||||
WalletClient, WalletDetails, WalletOutputBatch,
|
WalletClient, WalletDetails, WalletOutputBatch,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
use util::{kernel_sig_msg, secp};
|
use util::{kernel_sig_msg, secp};
|
||||||
|
|
||||||
use core::core::hash::Hash;
|
|
||||||
use core::core::{Input, Output, OutputFeatures, Transaction, TxKernel};
|
use core::core::{Input, Output, OutputFeatures, Transaction, TxKernel};
|
||||||
use keychain::{self, BlindSum, BlindingFactor, Identifier, Keychain};
|
use keychain::{self, BlindSum, BlindingFactor, Identifier, Keychain};
|
||||||
use libtx::{aggsig, proof};
|
use libtx::{aggsig, proof};
|
||||||
|
@ -43,7 +42,7 @@ where
|
||||||
|
|
||||||
/// Function type returned by the transaction combinators. Transforms a
|
/// Function type returned by the transaction combinators. Transforms a
|
||||||
/// (Transaction, BlindSum) pair into another, provided some context.
|
/// (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);
|
-> (Transaction, TxKernel, BlindSum);
|
||||||
|
|
||||||
/// Adds an input with the provided value and blinding key to the transaction
|
/// Adds an input with the provided value and blinding key to the transaction
|
||||||
|
|
|
@ -139,6 +139,7 @@ where
|
||||||
T: WalletBackend<K> + WalletClient,
|
T: WalletBackend<K> + WalletClient,
|
||||||
K: Keychain,
|
K: Keychain,
|
||||||
{
|
{
|
||||||
|
/// Create a new owner API handler for GET methods
|
||||||
pub fn new(wallet: Arc<Mutex<T>>) -> OwnerAPIGetHandler<T, K> {
|
pub fn new(wallet: Arc<Mutex<T>>) -> OwnerAPIGetHandler<T, K> {
|
||||||
OwnerAPIGetHandler {
|
OwnerAPIGetHandler {
|
||||||
wallet,
|
wallet,
|
||||||
|
@ -176,7 +177,7 @@ where
|
||||||
|
|
||||||
fn node_height(
|
fn node_height(
|
||||||
&self,
|
&self,
|
||||||
req: &mut Request,
|
_req: &mut Request,
|
||||||
api: &mut APIOwner<T, K>,
|
api: &mut APIOwner<T, K>,
|
||||||
) -> Result<(u64, bool), Error> {
|
) -> Result<(u64, bool), Error> {
|
||||||
api.node_height()
|
api.node_height()
|
||||||
|
@ -230,6 +231,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Handles all owner API POST requests
|
||||||
pub struct OwnerAPIPostHandler<T, K>
|
pub struct OwnerAPIPostHandler<T, K>
|
||||||
where
|
where
|
||||||
T: WalletBackend<K>,
|
T: WalletBackend<K>,
|
||||||
|
@ -245,6 +247,7 @@ where
|
||||||
T: WalletBackend<K> + WalletClient,
|
T: WalletBackend<K> + WalletClient,
|
||||||
K: Keychain,
|
K: Keychain,
|
||||||
{
|
{
|
||||||
|
/// New POST handler
|
||||||
pub fn new(wallet: Arc<Mutex<T>>) -> OwnerAPIPostHandler<T, K> {
|
pub fn new(wallet: Arc<Mutex<T>>) -> OwnerAPIPostHandler<T, K> {
|
||||||
OwnerAPIPostHandler {
|
OwnerAPIPostHandler {
|
||||||
wallet,
|
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
|
// TODO: Args
|
||||||
api.issue_burn_tx(60, 10, 1000)
|
api.issue_burn_tx(60, 10, 1000)
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,8 +73,6 @@ where
|
||||||
"Output found: {:?}, amount: {:?}", commit, info.value
|
"Output found: {:?}, amount: {:?}", commit, info.value
|
||||||
);
|
);
|
||||||
|
|
||||||
let commit_str = util::to_hex(commit.as_ref().to_vec());
|
|
||||||
|
|
||||||
let height = current_chain_height;
|
let height = current_chain_height;
|
||||||
let lock_height = if *is_coinbase {
|
let lock_height = if *is_coinbase {
|
||||||
height + global::coinbase_maturity()
|
height + global::coinbase_maturity()
|
||||||
|
|
|
@ -94,7 +94,7 @@ where
|
||||||
let mut batch = wallet.batch()?;
|
let mut batch = wallet.batch()?;
|
||||||
for id in lock_inputs {
|
for id in lock_inputs {
|
||||||
let mut coin = batch.get(&id).unwrap();
|
let mut coin = batch.get(&id).unwrap();
|
||||||
batch.lock_output(&mut coin);
|
batch.lock_output(&mut coin)?;
|
||||||
}
|
}
|
||||||
// write the output representing our change
|
// write the output representing our change
|
||||||
if let Some(d) = change_derivation {
|
if let Some(d) = change_derivation {
|
||||||
|
@ -109,7 +109,7 @@ where
|
||||||
height: current_height,
|
height: current_height,
|
||||||
lock_height: 0,
|
lock_height: 0,
|
||||||
is_coinbase: false,
|
is_coinbase: false,
|
||||||
});
|
})?;
|
||||||
}
|
}
|
||||||
batch.commit()?;
|
batch.commit()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -172,7 +172,7 @@ where
|
||||||
height: height,
|
height: height,
|
||||||
lock_height: 0,
|
lock_height: 0,
|
||||||
is_coinbase: false,
|
is_coinbase: false,
|
||||||
});
|
})?;
|
||||||
batch.commit()?;
|
batch.commit()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
|
|
|
@ -160,7 +160,7 @@ where
|
||||||
}
|
}
|
||||||
let mut batch = wallet.batch()?;
|
let mut batch = wallet.batch()?;
|
||||||
for id in ids_to_del {
|
for id in ids_to_del {
|
||||||
batch.delete(&id);
|
batch.delete(&id)?;
|
||||||
}
|
}
|
||||||
batch.commit()?;
|
batch.commit()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -265,7 +265,7 @@ where
|
||||||
height: height,
|
height: height,
|
||||||
lock_height: lock_height,
|
lock_height: lock_height,
|
||||||
is_coinbase: true,
|
is_coinbase: true,
|
||||||
});
|
})?;
|
||||||
batch.commit()?;
|
batch.commit()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,13 @@
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_map::Values;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{fs, path};
|
use std::{fs, path};
|
||||||
|
|
||||||
use failure::{Context, ResultExt};
|
use failure::ResultExt;
|
||||||
|
|
||||||
use keychain::{Identifier, Keychain};
|
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 client;
|
||||||
use libtx::slate::Slate;
|
use libtx::slate::Slate;
|
||||||
|
@ -38,7 +36,7 @@ const DERIV_PREFIX: u8 = 'd' as u8;
|
||||||
|
|
||||||
impl From<store::Error> for Error {
|
impl From<store::Error> for Error {
|
||||||
fn from(error: store::Error) -> Error {
|
fn from(error: store::Error) -> Error {
|
||||||
Error::from((ErrorKind::Backend(format!("{:?}", error))))
|
Error::from(ErrorKind::Backend(format!("{:?}", error)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue