Move new to top of impl block

To ease reading, put the `new` method at the top of the impl block.
Improve rustdocs while we do it.
This commit is contained in:
Tobin C. Harding 2022-08-09 14:26:38 +10:00
parent 08e55bc4f1
commit 25d1472924
1 changed files with 5 additions and 5 deletions

View File

@ -110,17 +110,17 @@ impl FilterHash {
} }
impl BlockFilter { impl BlockFilter {
/// Creates a new filter from pre-computed data.
pub fn new (content: &[u8]) -> BlockFilter {
BlockFilter { content: content.to_vec() }
}
/// compute this filter's id in a chain of filters /// compute this filter's id in a chain of filters
pub fn filter_header(&self, previous_filter_header: &FilterHeader) -> FilterHeader { pub fn filter_header(&self, previous_filter_header: &FilterHeader) -> FilterHeader {
let filter_hash = FilterHash::hash(self.content.as_slice()); let filter_hash = FilterHash::hash(self.content.as_slice());
filter_hash.filter_header(previous_filter_header) filter_hash.filter_header(previous_filter_header)
} }
/// create a new filter from pre-computed data
pub fn new (content: &[u8]) -> BlockFilter {
BlockFilter { content: content.to_vec() }
}
/// Compute a SCRIPT_FILTER that contains spent and output scripts /// Compute a SCRIPT_FILTER that contains spent and output scripts
pub fn new_script_filter<M>(block: &Block, script_for_coin: M) -> Result<BlockFilter, Error> pub fn new_script_filter<M>(block: &Block, script_for_coin: M) -> Result<BlockFilter, Error>
where M: Fn(&OutPoint) -> Result<Script, Error> { where M: Fn(&OutPoint) -> Result<Script, Error> {