rust-bitcoin-unsafe-fast/bitcoin/src/blockdata/script
Tobin C. Harding e87a54f617
Enforce script size limit when hashing scripts
There are two limits that the Bitcoin network enforces in regard to
hashing scripts

- For P2SH the redeem script must be less than 520 bytes
- For P2WSH the witness script must be less than 10,000 bytes

Currently we are only enforcing the p2sh limit when creating an address
with `Address::p2sh`.

There are various ways to create addresses from script hashes and if
users manually hash a script then use the `ScriptHash` (or
`WScritpHash`) our APIs assume the script that was hashed is valid. This
means there is the potential for users to get burned by creating
addresses that cannot be spent, something we would like to avoid.

- Add fallible constructors to `ScriptHash` and `WScriptHash`
- Add `TryFrom` impls as well to both types
- Remove the `From` impls
2024-06-17 10:32:03 +10:00
..
borrowed.rs Enforce script size limit when hashing scripts 2024-06-17 10:32:03 +10:00
builder.rs Pass keys by value 2024-06-14 14:16:28 +10:00
instruction.rs refactor(script): move `read_scriptint` to `PushBytes` & create `read_int` function 2024-05-28 15:36:17 +05:30
mod.rs Enforce script size limit when hashing scripts 2024-06-17 10:32:03 +10:00
owned.rs Pass keys by value 2024-06-14 14:16:28 +10:00
push_bytes.rs refactor(script): move `read_scriptint` to `PushBytes` & create `read_int` function 2024-05-28 15:36:17 +05:30
tests.rs Enforce script size limit when hashing scripts 2024-06-17 10:32:03 +10:00
witness_program.rs Enforce script size limit when hashing scripts 2024-06-17 10:32:03 +10:00
witness_version.rs Merge rust-bitcoin/rust-bitcoin#2569: Move types to `units` 2024-03-15 22:43:51 +00:00