Currently new keys and hashes are generated with calls to rando.generateSeed all over the codebase, sometimes using the KEY_SIZE and HASH_SIZE constants and often wrapping the resulting byte sequence with ByteArray.
This PR refactors most of those calls to use four new functions instead: newHash, newHashRaw, newKey, newKeyRaw. This reduces redundancy and increases clarity about the meaning of each generated byte sequence.
It also includes a lot of formatting cleanup in test_txscript.py.
Please check the changes, I'm a little fuzzy about the semantic differences among seeds, hashes and keys. Do we also need two newSeed and newSeedRaw functions and a SEED_SIZE constant?
Currently new keys and hashes are generated with calls to
rando.generateSeed
all over the codebase, sometimes using theKEY_SIZE
andHASH_SIZE
constants and often wrapping the resulting byte sequence withByteArray
.This PR refactors most of those calls to use four new functions instead:
newHash
,newHashRaw
,newKey
,newKeyRaw
. This reduces redundancy and increases clarity about the meaning of each generated byte sequence.It also includes a lot of formatting cleanup in
test_txscript.py
.Please check the changes, I'm a little fuzzy about the semantic differences among seeds, hashes and keys. Do we also need two
newSeed
andnewSeedRaw
functions and aSEED_SIZE
constant?