make pad_tx produce the correct size when possible
Summary:
Previously, pad_tx was overpadding transactions by at least 1 byte. This was caused by at least 2 reasons:
- the byte encoding the data length after the OP_RETURN was not taken into
- the additional byte required by OP_PUSHDATA1 when the data length exceeded 0x4c was not taken into account
This is an attempt to make the resulting length match the required length in most situation.
Now, it should only differ in cases where the request size is less than one empty vout (10 bytes) above the current tx size.
Test Plan: ninja check-functional-extended
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D10276