d56d202aeb
Some smart contracts or simplified wallets statically know the sizes of transactions or inputs. The possible approaches to handling them so far were re-computing the values (and hoping the optimizer will const fold them) or using a simple constant which may be harder to understand and get right. It's much nicer to just use a `const` but our code didn't support it until now. This change adds methods that can compute the prediction in `const` context for Rust versions >= 1.46.0 which allow use of loops (and conditions but those could be workaround anyway). As a side effect of this, the change also adds `const` to `VarInt::len` in Rust 1.46+. While this one could be made unconditional using array trick it's probably not worth it because of the planned MSRV bump. Note: this commit is intentionally unformatted to make diff easier to understand. Formatting will be done in future commit. |
||
---|---|---|
.. | ||
contrib | ||
embedded | ||
examples | ||
fuzz | ||
src | ||
tests | ||
CHANGELOG.md | ||
Cargo.toml | ||
build.rs |