Page MenuHomePhabricator

[qa] fix pad_tx to better match the desired size
ClosedPublic

Authored by schancel on Mon, Nov 19, 07:27.

Details

Summary

Currently, pad_tx overpads quite often. This diff makes it pad the
correct amount except in specific cases. This enables us to simplify
some other tests which need to pad blocks.

Test Plan
./test/functional/test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

schancel created this revision.Mon, Nov 19, 07:27
Herald added a reviewer: Restricted Project. · View Herald TranscriptMon, Nov 19, 07:27
jasonbcox added inline comments.
test/functional/test_framework/txtools.py
53 ↗(On Diff #5926)

remove

55 ↗(On Diff #5926)

Rebase

schancel updated this revision to Diff 5927.Mon, Nov 19, 07:29

Rebase fix comment

jasonbcox requested changes to this revision.Mon, Nov 19, 07:32
jasonbcox added inline comments.
test/functional/test_framework/txtools.py
27 ↗(On Diff #5926)

Does this deserve it's own assert before the loop? This way, we can provide a useful error message if the caller manages to build such a tx

28 ↗(On Diff #5926)

These comments should refer to pad_to_size, not MAX_TX_SIZE

This revision now requires changes to proceed.Mon, Nov 19, 07:32
jasonbcox added inline comments.Mon, Nov 19, 07:33
test/functional/test_framework/txtools.py
44 ↗(On Diff #5927)

temp variable for required_padding - padding_len - extra_bytes

jasonbcox added inline comments.Mon, Nov 19, 07:35
test/functional/test_framework/txtools.py
35 ↗(On Diff #5927)

padding_len is always equal to required_padding at this line. remove this line and make the next line:
padding_len = min(required_padding, MAX_TXOUT_PUBKEY_SCRIPT - extra_bytes)

schancel updated this revision to Diff 5931.Mon, Nov 19, 08:12

Fix feedback

jasonbcox accepted this revision.Mon, Nov 19, 08:16
This revision is now accepted and ready to land.Mon, Nov 19, 08:16
This revision was automatically updated to reflect the committed changes.