BCH May 2023 Upgrade: Allow for txn sizes as small as 65 bytes
Summary
Please see discussion here: https://bitcoincashresearch.org/t/chip-2021-01-allow-transactions-to-be-smaller-in-size
This MR reduces the minimum txn size for Upgrade9 (May 2023
network upgrade) to 65
bytes from the existing 100
byte minimum size that
we have had since Magnetic Anomaly activated in Nov 2018.
The original motivation for imposing a minimum size at all was in
order to avoid a merkle tree exploit that is possible for txns of
precisely 64
bytes in size. However, the size of 100
bytes was chosen
arbitrarily and it has been known to at least break some mining software
that comes from BTC and is unaware that they need to pad their coinbase
txns (often by default they get a 98
byte coinbase).
As such, it would be more useful for everybody if the min. txn size was
reduced to 65
bytes. Note that another approach would have been to
simply forbid 64
byte sizes and allow for even smaller txn sizes. The
smallest possible trivial txn that pays out to an empty script is 60
bytes.
However such small txns are not very useful, and it was felt the author of
this MR and others that it is easier and more natural to enforce a minimum
size of 65
, rather than have a single forbidden size of 64
. (It also
is likely to fit into the existing logic of extant software which was
just enforcing a minimum of 100
to simply reduce this constant down to
65
-- in the BCHN codebase it was indeed better to do it this way).
The functional test that was added carefully tests the the 100
-byte
rule pre-upgrade9 and then moves the blockchain forward to activate
upgrade9, at which time it tests that the minimum size has indeed been
reduced to 65
.
Test Plan
ninja all check-all