rust-bitcoin-unsafe-fast/bitcoin
Martin Habovstiak d56d202aeb Support weight prediction in `const` context
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.
2023-03-17 08:16:17 +01:00
..
contrib Fix CI builds where default features are added accidentally 2023-03-12 20:24:55 +00:00
embedded Instruct devs to use nightly for embedded 2023-02-03 08:44:47 +11:00
examples Run the formatter 2023-03-06 10:22:29 +11:00
fuzz Add a newtype for script-pushable slice 2023-02-18 16:35:25 +01:00
src Support weight prediction in `const` context 2023-03-17 08:16:17 +01:00
tests Run the formatter 2023-03-06 10:22:29 +11:00
CHANGELOG.md add some documentation clarifying the locktime ordering shenanigans in #1330 2022-12-15 23:12:03 +00:00
Cargo.toml rename bitcoin-internals to bitcoin-private 2023-03-13 16:02:12 +00:00
build.rs Set rustv_1_53 in build script 2023-02-02 10:12:16 +11:00