File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,11 @@ impl AsyncClient {
116116 /// Get a [`BlockHeader`] given a particular block height.
117117 pub async fn get_header ( & self , block_height : u32 ) -> Result < BlockHeader , Error > {
118118 let block_hash = self . get_block_hash ( block_height) . await ?;
119+ self . get_header_by_hash ( & block_hash) . await
120+ }
119121
122+ /// Get a [`BlockHeader`] given a particular block hash.
123+ pub async fn get_header_by_hash ( & self , block_hash : & BlockHash ) -> Result < BlockHeader , Error > {
120124 let resp = self
121125 . client
122126 . get ( & format ! ( "{}/block/{}/header" , self . url, block_hash) )
Original file line number Diff line number Diff line change @@ -129,7 +129,11 @@ impl BlockingClient {
129129 /// Get a [`BlockHeader`] given a particular block height.
130130 pub fn get_header ( & self , block_height : u32 ) -> Result < BlockHeader , Error > {
131131 let block_hash = self . get_block_hash ( block_height) ?;
132+ self . get_header_by_hash ( & block_hash)
133+ }
132134
135+ /// Get a [`BlockHeader`] given a particular block hash.
136+ pub fn get_header_by_hash ( & self , block_hash : & BlockHash ) -> Result < BlockHeader , Error > {
133137 let resp = self
134138 . agent
135139 . get ( & format ! ( "{}/block/{}/header" , self . url, block_hash) )
You can’t perform that action at this time.
0 commit comments