Bitcoin ABC  0.22.12
P2P Digital Currency
convert-raw-to-header.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 # Copyright (c) 2019 The Bitcoin developers
3 
4 import sys
5 
6 
7 def main(test_name, input_file):
8  with open(input_file, "rb") as f:
9  contents = f.read()
10 
11  print("static unsigned const char {}_raw[] = {{".format(test_name))
12  print(", ".join(map(lambda x: "0x{:02x}".format(x), contents)))
13  print("};")
14 
15 
16 if __name__ == "__main__":
17  if len(sys.argv) != 3:
18  print("We need additional pylons!")
19  sys.exit(1)
20 
21  main(sys.argv[1], sys.argv[2])
void format(std::ostream &out, const char *fmt, const Args &... args)
Format list of arguments to the stream according to given format string.
Definition: tinyformat.h:1111
def main(test_name, input_file)