rest: fix unreachable provably-unspendable script classification - #246
rest: fix unreachable provably-unspendable script classification#246zloglevel wants to merge 1 commit into
Conversation
Signed-off-by: zloglevel <loglevel@outlook.com>
|
Thank for your submission. The duplicated is_op_return() branch is clearly unreachable, and this restores the original REST distinction between op_return and other provably-unspendable scripts. (changed with e497577) Could we avoid introducing a new call to the deprecated bitcoin::Script::is_provably_unspendable() and suppressing it with #[allow(deprecated)]? The same compatibility issue was handled in mempool/electrs#138 (mempool/electrs#138), specifically in commit f8302d7c (mempool/electrs@f8302d7). It defines a small feature-specific IsProvablyUnspendable helper: the Bitcoin implementation preserves the existing ReturnOp | IllegalOp behavior, while the Liquid implementation delegates to elements::Script::is_provably_unspendable(). Using the same approach here would preserve the intended API behavior without depending on a method that rust-bitcoin plans to remove. It would also be good to run the new unit test under both the default and liquid configurations rather than only cargo check. |
Summary
Fix REST output script classification for provably unspendable scripts.
The existing classification contained two identical
is_op_return()branches.The second branch was unreachable, causing non-OP_RETURN provably unspendable scripts to be reported as
unknown.Changes
is_op_return()check withis_provably_unspendable().op_returnclassification by checking it first.Verification
cargo +1.92.0 check --libcargo +1.92.0 check --lib --features liquid