Commit 8d2f491e authored by Riccardo Casatta's avatar Riccardo Casatta
Browse files

update rust-bitcoin dep to 0.14

parent 2d2590ae
......@@ -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"
......
......@@ -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());
......
......@@ -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(),
......
......@@ -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[..])?))
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment