INNER CODE UNIT · Python
maybe_gen_comment
BlockstreamResearch/secp256k1-zkp · tools/tests_silentpayments_generate.py:75
def maybe_gen_comment(comment):
if comment:
return f" /* {comment} */"
else:
return ""
def gen_key_material(keys, comment=None, prepend_count=False):
assert len(keys) <= MAX_INPUTS_PER_TEST_CASE
out = ""
if prepend_count:
out += f" {len(keys)},\n"
out += f" {{{maybe_gen_comment(comment)}\n"
for k in keys:
out += f" {gen_byte_array(k)},\n"
if not keys:
out += ' "",\n'
out += " },\n"
return out