File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
verifier/src/types/extension Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -143,16 +143,17 @@ fn test_spv_client(
143
143
144
144
log:: debug!( ">>> with confirmations {confirmations}" ) ;
145
145
146
+ let txid_array = txid. as_ref ( ) ;
146
147
let verify_result = tip_client
147
- . verify_transaction ( & txid , tx_proof. as_reader ( ) , confirmations - 1 )
148
+ . verify_transaction ( txid_array , tx_proof. as_reader ( ) , confirmations - 1 )
148
149
. map_err ( |err| err as i8 ) ;
149
150
assert ! ( verify_result. is_ok( ) ) ;
150
151
let verify_result = tip_client
151
- . verify_transaction ( & txid , tx_proof. as_reader ( ) , confirmations)
152
+ . verify_transaction ( txid_array , tx_proof. as_reader ( ) , confirmations)
152
153
. map_err ( |err| err as i8 ) ;
153
154
assert ! ( verify_result. is_ok( ) ) ;
154
155
let verify_result = tip_client
155
- . verify_transaction ( & txid , tx_proof. as_reader ( ) , confirmations + 1 )
156
+ . verify_transaction ( txid_array , tx_proof. as_reader ( ) , confirmations + 1 )
156
157
. map_err ( |err| err as i8 ) ;
157
158
assert ! ( verify_result. is_err( ) ) ;
158
159
}
Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ impl packed::SpvClient {
268
268
let tx: core:: Transaction =
269
269
deserialize ( tx) . map_err ( |_| VerifyTxError :: DecodeTransaction ) ?;
270
270
let txid = tx. txid ( ) ;
271
- let header = self . verify_transaction ( & txid, tx_proof, confirmations) ?;
271
+ let header = self . verify_transaction ( txid. as_ref ( ) , tx_proof, confirmations) ?;
272
272
Ok ( ( header, tx) )
273
273
}
274
274
@@ -286,7 +286,7 @@ impl packed::SpvClient {
286
286
/// If you don't need it, just ignore it.
287
287
pub fn verify_transaction (
288
288
& self ,
289
- txid : & core :: Txid ,
289
+ txid : & [ u8 ; 32 ] ,
290
290
tx_proof : packed:: TransactionProofReader ,
291
291
confirmations : u32 ,
292
292
) -> Result < core:: Header , VerifyTxError > {
@@ -328,8 +328,9 @@ impl packed::SpvClient {
328
328
. position ( |v| v == tx_index)
329
329
. map ( |i| matches[ i] )
330
330
. ok_or ( VerifyTxError :: TxOutProofInvalidTxIndex )
331
- . and_then ( |ref id| {
332
- if id == txid {
331
+ . and_then ( |id| {
332
+ let id_bytes: & [ u8 ; 32 ] = id. as_ref ( ) ;
333
+ if id_bytes == txid {
333
334
Ok ( ( ) )
334
335
} else {
335
336
Err ( VerifyTxError :: TxOutProofInvalidTxId )
You can’t perform that action at this time.
0 commit comments