Skip to content

Commit 78dbc20

Browse files
committed
Let get_output_status use a u64 for the index
1 parent 5a14886 commit 78dbc20

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub struct MerkleProof {
5151
pub struct OutputStatus {
5252
spent: bool,
5353
txid: Option<Txid>,
54-
vin: Option<Vin>,
54+
vin: Option<u64>,
5555
status: Option<TxStatus>,
5656
}
5757

src/async.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use log::{debug, error, info, trace};
2323

2424
use reqwest::{Client, StatusCode};
2525

26-
use crate::{Builder, Error, MerkleProof, OutputStatus, Tx, TxStatus, Vout};
26+
use crate::{Builder, Error, MerkleProof, OutputStatus, Tx, TxStatus};
2727

2828
#[derive(Debug)]
2929
pub struct AsyncClient {
@@ -134,15 +134,15 @@ impl AsyncClient {
134134
Ok(Some(resp.error_for_status()?.json().await?))
135135
}
136136

137-
/// Get the spending status of an output given a [`Txid`] and [`Vout`].
137+
/// Get the spending status of an output given a [`Txid`] and the output index.
138138
pub async fn get_output_status(
139139
&self,
140140
txid: &Txid,
141-
vout: &Vout,
141+
index: u64,
142142
) -> Result<Option<OutputStatus>, Error> {
143143
let resp = self
144144
.client
145-
.get(&format!("{}/tx/{}/outspend/{}", self.url, txid, vout.value))
145+
.get(&format!("{}/tx/{}/outspend/{}", self.url, txid, index))
146146
.send()
147147
.await?;
148148

src/blocking.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use bitcoin::hashes::hex::{FromHex, ToHex};
2626
use bitcoin::hashes::{sha256, Hash};
2727
use bitcoin::{BlockHeader, Script, Transaction, Txid};
2828

29-
use crate::{Builder, Error, MerkleProof, OutputStatus, Tx, TxStatus, Vout};
29+
use crate::{Builder, Error, MerkleProof, OutputStatus, Tx, TxStatus};
3030

3131
#[derive(Debug, Clone)]
3232
pub struct BlockingClient {
@@ -149,15 +149,15 @@ impl BlockingClient {
149149
}
150150
}
151151

152-
/// Get the spending status of an output given a [`Txid`] and [`Vout`].
152+
/// Get the spending status of an output given a [`Txid`] and the output index.
153153
pub fn get_output_status(
154154
&self,
155155
txid: &Txid,
156-
vout: &Vout,
156+
index: u64,
157157
) -> Result<Option<OutputStatus>, Error> {
158158
let resp = self
159159
.agent
160-
.get(&format!("{}/tx/{}/outspend/{}", self.url, txid, vout.value))
160+
.get(&format!("{}/tx/{}/outspend/{}", self.url, txid, index))
161161
.call();
162162

163163
match resp {

0 commit comments

Comments
 (0)