forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: release note for asm repr script changes
- Loading branch information
1 parent
b3a8c40
commit 4890626
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Notable changes | ||
|
||
## Updated RPCs | ||
|
||
- Script decoding behaviour has been updated which presents in various RPCs. | ||
|
||
Previously, the `asm` representations silently displayed pushed values of 4 bytes or fewer in decimal encoding, while representing values larger than 4 bytes in hexadecimal. | ||
This inconsistent behaviour, which was not documented, led to confusion when interpreting various values. | ||
|
||
The following changes have been implemented to provide a unambiguous asm encoding which can (in the future) be decoded: | ||
|
||
- Drop `OP_` prefix from all opcodes: | ||
|
||
e.g. `OP_n` -> `n` (so `-1`, `0`, `1`, ..., `10`, ..., `16`) | ||
|
||
e.g. `OP_CHECKSIG` -> `CHECKSIG` | ||
|
||
- For non-minimal pushes prefix with the opcode and enclose pushed hex value in angle brackets | ||
|
||
e.g. `4c01aa` -> `PUSHDATA1<aa>` | ||
|
||
- For minimal pushes: | ||
|
||
- If > 5 bytes display pushed hex value enclosed in angle brackets | ||
|
||
e.g. `06aabbccddeeff` -> `<aabbccddeeff>` | ||
|
||
- If \<= 5 bytes: | ||
|
||
- If minimally-encoded display pushed value in decimal without angle brackets | ||
|
||
e.g. `0142` -> `66` | ||
|
||
- If not minimally-encoded display pushed hex value enclosed in angle brackets | ||
|
||
e.g. `024200` -> `<4200>` | ||
|
||
The asm can be unambiguously decoded using the reverse rules: | ||
|
||
- A decimal number without angle brackets -> an `OP_N` if applicable, otherwise a direct push of the minimally-encoded form of that number. | ||
- `<...>` is turned into a direct push if up to 75 bytes, into `OP_PUSHDATA1` if below 256 bytes, into `OP_PUSHDATA2` if below 65536 bytes, and into `OP_PUSHDATA4` otherwise. | ||
- `OPCODE<...>` is turned into a push using the relevant opcode. | ||
|
||
These changes will affect the `asm` output of the `getrawtransaction`, `decodetransaction`, `decodescript` and `decodepsbt` RPCs. | ||
See #7996 and #27795 for more discussion. |