rust-bitcoin-unsafe-fast/bitcoin
Andrew Poelstra f231617103
Merge rust-bitcoin/rust-bitcoin#1330: Remove `PackedLockTime` in favor of `absolute::LockTime`
1b15a13e5a run cargo clippy and fmt (Andrew Poelstra)
f2a5596899 examples: clean up taproot PSBT example locktime handling (Andrew Poelstra)
821842e1a1 drop Ord on absolute::LockTime; add Ord to Transaction (Andrew Poelstra)
5b7d801ee6 remove PackedLockTime type (Andrew Poelstra)
4dee116b8a delete PackedLockTime by aliasing it to LockTime (Andrew Poelstra)
fa81568fb6 locktime: add `FromHexStr` impl for `LockTime` (Andrew Poelstra)
74ff4946e4 locktime: unify serde impls (Andrew Poelstra)

Pull request description:

  This is potentially a controversial PR, but hear me out. My argument is that right now `absolute::LockTime` and `PackedLockTime` are basically identical types; they can be converted between each other with `From` and they have exactly the same semantics except that `PackedLockTime` has `Ord` on it. This makes it very confusing to tell which one should be used, for example in PSBT2 where there are now extra locktime-related fields.

  The motivation for having `PackedLockTime` independent of `LockTime` are:
  * `PackedLockTime` is theoretically more efficient because you don't need to unpack the field, don't need to store a enum discriminate, etc. I don't buy this. If you are trying to save individual bytes in your transaction-parsing there are lots of places you'd look before messing around with locktimes, so we shouldn't privilege this specific thing.
  * `PackedLockTIme` has an `Ord` impl, and removing that will have a cascading effect on transactions, blocks, etc., preventing them from being held in `BTreeMaps` etc. **My proposal**, implemented here, is to just manually impl `Ord` on `Transaction` and don't impl it on `LockTime`.

  I recall some argument that we need to be able to sort miniscripts, and miniscripts might have locktimes in them, but I think this is wrong -- miniscripts always have explicitly either a `Height` or a `Time`, and there is no problem ordering these.

  Closes #1455

ACKs for top commit:
  sanket1729:
    code review ACK 1b15a13e5a
  tcharding:
    ACK 1b15a13e5a

Tree-SHA512: d9776f14560c3822980e8fff8978bf8ca753035152f957a84af25d063c66e4e9df3d5cf98af38d6cb59cc52ba407282f722925b1ca670ae623ac91add3149d2f
2022-12-14 18:21:07 +00:00
..
contrib Fail CI if docs build throws warnings 2022-11-21 10:35:49 +11:00
embedded hashes: Do not implement Deref 2022-12-12 12:05:54 +11:00
examples run cargo clippy and fmt 2022-12-13 14:52:43 +00:00
fuzz Merge rust-bitcoin/rust-bitcoin#1284: Import bitcoin hashes 2022-11-18 18:32:41 +00:00
src run cargo clippy and fmt 2022-12-13 14:52:43 +00:00
tests remove PackedLockTime type 2022-12-11 19:08:14 +00:00
CHANGELOG.md Move CHANGELOG to bitcoin crate 2022-11-08 08:40:44 +11:00
Cargo.toml Implement consensus encoding adapter for serde 2022-12-02 10:48:05 +01:00
build.rs Implement consensus encoding adapter for serde 2022-12-02 10:48:05 +01:00