Allowing arbitrary hex data to be wrapped in sh()
, wsh()
, or even within the TREE
argument of a tr(KEY, TREE)
descriptor enables the representation of currently
inexpressible information.
Specifically, the absence of this feature limits the representation of non-standard redeem
and witness scripts. This occurs because they can currently only be represented as top-level
raw(HEX)
descriptors, which retain only the output script information and lack the ability
to preserve the actual script.
This work stemmed from discussions with @sipa and @achow101 about the legacy wallet migration path, particularly while investigating migrated descriptors that lacked information about the script they were supposedly migrated from.
Additionally, issue #24114, specifically https://github.com/bitcoin/bitcoin/issues/24114#issuecomment-1127978154, provides historical context and highlights other valid use cases enabled by this behavior change.