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 {
116
116
/// Get a [`BlockHeader`] given a particular block height.
117
117
pub async fn get_header ( & self , block_height : u32 ) -> Result < BlockHeader , Error > {
118
118
let block_hash = self . get_block_hash ( block_height) . await ?;
119
+ self . get_header_by_hash ( & block_hash) . await
120
+ }
119
121
122
+ /// Get a [`BlockHeader`] given a particular block hash.
123
+ pub async fn get_header_by_hash ( & self , block_hash : & BlockHash ) -> Result < BlockHeader , Error > {
120
124
let resp = self
121
125
. client
122
126
. get ( & format ! ( "{}/block/{}/header" , self . url, block_hash) )
Original file line number Diff line number Diff line change @@ -129,7 +129,11 @@ impl BlockingClient {
129
129
/// Get a [`BlockHeader`] given a particular block height.
130
130
pub fn get_header ( & self , block_height : u32 ) -> Result < BlockHeader , Error > {
131
131
let block_hash = self . get_block_hash ( block_height) ?;
132
+ self . get_header_by_hash ( & block_hash)
133
+ }
132
134
135
+ /// Get a [`BlockHeader`] given a particular block hash.
136
+ pub fn get_header_by_hash ( & self , block_hash : & BlockHash ) -> Result < BlockHeader , Error > {
133
137
let resp = self
134
138
. agent
135
139
. get ( & format ! ( "{}/block/{}/header" , self . url, block_hash) )
You can’t perform that action at this time.
0 commit comments