Commit description:
> This optional parameter is never used, so remove it.
PR description:
> Lots of small fixes:
>
> moving unit tests to test_framework implementation files
> renaming functions to be clearer
> removing multiple imports
> removing unreadable byte literals from the code
> fixing pep8 violations
> correcting out-of-date docstring
Most of the PR is related to segwit or code style, so only 2 out of 7 commits are relevant.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/19253 | core#19253]] [1/2]
https://github.com/bitcoin/bitcoin/pull/19253/commits/825fcae484f31182041dfacbf820e818d759b130