Skip to content

Can we drop Ord on AbsLockTime and RelLockTime? #979

@apoelstra

Description

@apoelstra

These types implement Ord so that we could derive Ord on Terminal (which in turn is used to order descriptors, but the ordering on descriptors is supposed to be lexicographic since descriptors are strings).

Upstream's locktimes avoid implementing this since it's rarely meaningful to compare locktimes that mix times and heights. In #537, when upgrading to rust-bitcoin 0.30, we just bodged our own Ord impls onto our locktime types, since we had them anyway, since Miniscript enforces locktimes to be nonzero. Indeed, our use of Ord on locktimes has caused some pathological behavior. See the regression_895 unit test which demonstrates this. (Despite the name, this "regression test" does not test that any bug has been fixed; it only documents the particular form of bug that exists.)

Since #722 we no longer derive Ord on Terminal. Instead we have a manual implementation which uses our display logic to get a lexicographic order without using recursive functions.

So the original motivation for having Ord on locktimes no longer applies, and we should attempt to eliminate it as a way of shaking out any ordering-related locktime bugs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions