update rust-bitcoin dep to 0.14

This commit is contained in:
Riccardo Casatta 2018-08-24 10:57:19 +02:00
parent 2d2590aeae
commit 8d2f491e91
4 changed files with 9 additions and 9 deletions

View File

@ -14,7 +14,7 @@ readme = "README.md"
arrayref = "0.3"
base64 = "0.9"
bincode = "1.0"
bitcoin = "0.13"
bitcoin = "0.14"
chan = "0.1"
chan-signal = "0.3"
clap = "2.31"

View File

@ -39,8 +39,8 @@ impl TxInRow {
TxInRow {
key: TxInKey {
code: b'I',
prev_hash_prefix: hash_prefix(&input.prev_hash[..]),
prev_index: input.prev_index as u16,
prev_hash_prefix: hash_prefix(&input.previous_output.txid.as_bytes()[..]),
prev_index: input.previous_output.vout as u16,
},
txid_prefix: hash_prefix(&txid[..]),
}
@ -171,7 +171,7 @@ pub fn index_transaction(txn: &Transaction, height: usize, rows: &mut Vec<Row>)
let null_hash = Sha256dHash::default();
let txid: Sha256dHash = txn.txid();
for input in &txn.input {
if input.prev_hash == null_hash {
if input.previous_output.txid == null_hash {
continue;
}
rows.push(TxInRow::new(&txid, &input).to_row());

View File

@ -227,8 +227,8 @@ impl Query {
let mut spending_inputs = vec![];
for t in &spending_txns {
for input in t.txn.input.iter() {
if input.prev_hash == funding.txn_id
&& input.prev_index == funding.output_index as u32
if input.previous_output.txid == funding.txn_id
&& input.previous_output.vout == funding.output_index as u32
{
spending_inputs.push(SpendingInput {
txn_id: t.txn.txid(),

View File

@ -175,7 +175,7 @@ impl Connection {
fn blockchain_address_subscribe(&mut self, params: &[Value]) -> Result<Value> {
let addr = address_from_value(params.get(0)).chain_err(|| "bad address")?;
let script_hash = compute_script_hash(&addr.script_pubkey().into_vec());
let script_hash = compute_script_hash(&addr.script_pubkey().into_bytes());
let status = self.query.status(&script_hash[..])?;
let result = status.hash().map_or(Value::Null, |h| json!(hex::encode(h)));
let script_hash: Sha256dHash = deserialize(&script_hash).unwrap();
@ -193,7 +193,7 @@ impl Connection {
fn blockchain_address_get_balance(&self, params: &[Value]) -> Result<Value> {
let addr = address_from_value(params.get(0)).chain_err(|| "bad address")?;
let script_hash = compute_script_hash(&addr.script_pubkey().into_vec());
let script_hash = compute_script_hash(&addr.script_pubkey().into_bytes());
let status = self.query.status(&script_hash[..])?;
Ok(
json!({ "confirmed": status.confirmed_balance(), "unconfirmed": status.mempool_balance() }),
@ -219,7 +219,7 @@ impl Connection {
fn blockchain_address_listunspent(&self, params: &[Value]) -> Result<Value> {
let addr = address_from_value(params.get(0)).chain_err(|| "bad address")?;
let script_hash = compute_script_hash(&addr.script_pubkey().into_vec());
let script_hash = compute_script_hash(&addr.script_pubkey().into_bytes());
Ok(unspent_from_status(&self.query.status(&script_hash[..])?))
}