Improve the public API for Feerate and Weight#1685
Improve the public API for Feerate and Weight#1685apoelstra merged 1 commit intorust-bitcoin:masterfrom
Conversation
| pub use crate::blockdata::locktime::{self, absolute, relative}; | ||
| pub use crate::blockdata::script::{self, Script, ScriptBuf}; | ||
| pub use crate::blockdata::transaction::{self, OutPoint, Sequence, Transaction, TxIn, TxOut}; | ||
| pub use crate::blockdata::weight::Weight; |
There was a problem hiding this comment.
Maybe as BlockWeight to improve clarity? bitcoin::Weight looks a bit strange.
There was a problem hiding this comment.
FWIW, I would be confused if it's TxWeight or BlockWeight where the latter refers to segwit calculated total bitcoin block weight.
There was a problem hiding this comment.
I think the docstring does a great job of this clarification already
/// Represents block weight - the weight of a transaction or block.
///
/// This is an integer newtype representing weigth inwu. It provides protection against mixing
/// up the types as well as basic formatting features.
There was a problem hiding this comment.
I don't think "blockweight" makes sense. Weight can apply to transactions just as well (and this is the more common case).
I think bitcoin::Weight looks fine. "weight" is a standard unit in Bitcoin.
There was a problem hiding this comment.
In my mind calling transaction weight "block weight" was OK because it refers to how much weight does it take in block. But OK, looks like simple Weight is fine.
Small nit for #1627 to re-export
WeightandFeeRateto shorten the use path.