@@ -145,6 +145,17 @@ where
145
145
( * * self ) . transaction_get_merkle ( txid, height)
146
146
}
147
147
148
+ fn batch_transaction_get_merkle < ' s , I > (
149
+ & self ,
150
+ txids_and_heights : I ,
151
+ ) -> Result < Vec < GetMerkleRes > , Error >
152
+ where
153
+ I : IntoIterator + Clone ,
154
+ I :: Item : Borrow < & ' s ( Txid , usize ) > ,
155
+ {
156
+ ( * * self ) . batch_transaction_get_merkle ( txids_and_heights)
157
+ }
158
+
148
159
fn txid_from_pos ( & self , height : usize , tx_pos : usize ) -> Result < Txid , Error > {
149
160
( * * self ) . txid_from_pos ( height, tx_pos)
150
161
}
@@ -362,6 +373,17 @@ pub trait ElectrumApi {
362
373
/// Returns the merkle path for the transaction `txid` confirmed in the block at `height`.
363
374
fn transaction_get_merkle ( & self , txid : & Txid , height : usize ) -> Result < GetMerkleRes , Error > ;
364
375
376
+ /// Batch version of [`transaction_get_merkle`](#method.transaction_get_merkle).
377
+ ///
378
+ /// Take a list of `(txid, height)`, for transactions with `txid` confirmed in the block at `height`.
379
+ fn batch_transaction_get_merkle < ' s , I > (
380
+ & self ,
381
+ txids_and_heights : I ,
382
+ ) -> Result < Vec < GetMerkleRes > , Error >
383
+ where
384
+ I : IntoIterator + Clone ,
385
+ I :: Item : Borrow < & ' s ( Txid , usize ) > ;
386
+
365
387
/// Returns a transaction hash, given a block `height` and a `tx_pos` in the block.
366
388
fn txid_from_pos ( & self , height : usize , tx_pos : usize ) -> Result < Txid , Error > ;
367
389
@@ -558,6 +580,17 @@ mod test {
558
580
unreachable ! ( )
559
581
}
560
582
583
+ fn batch_transaction_get_merkle < ' s , I > (
584
+ & self ,
585
+ _: I ,
586
+ ) -> Result < Vec < crate :: GetMerkleRes > , crate :: Error >
587
+ where
588
+ I : IntoIterator + Clone ,
589
+ I :: Item : std:: borrow:: Borrow < & ' s ( bitcoin:: Txid , usize ) > ,
590
+ {
591
+ unreachable ! ( )
592
+ }
593
+
561
594
fn txid_from_pos ( & self , _: usize , _: usize ) -> Result < bitcoin:: Txid , super :: Error > {
562
595
unreachable ! ( )
563
596
}
0 commit comments