dev2main (#3)

* initial code commit

* fixes

* fix prints not showing in docker

* add github workflow

* fix naming of docker image build workflow

* add helm chart

* fix "connection is already closed"

* some big improvements in main script
This commit is contained in:
PascalR 2023-04-12 16:31:43 +02:00 committed by GitHub
parent 3632666f1c
commit 59e788c75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,20 +14,19 @@ relay_manager.open_connections({"cert_reqs": ssl.CERT_NONE}) # NOTE: This disabl
time.sleep(1.25) # allow the connections to open
env_private_key = os.environ.get("PRIVATE_KEY")
# print the value of the environment variable, if it exists
if not env_private_key:
print('The environment variable "PRIVATE_KEY" is not set.')
exit(1)
private_key = PrivateKey(bytes.fromhex(env_private_key))
old_block_height = 0
while True:
old_block_height = 0
url = "https://blockchain.info/latestblock"
response = requests.get(url)
data = response.json()
block_height = data["height"]
if(block_height > old_block_height):
print("Die aktuelle Bitcoin-Blockhöhe beträgt:", block_height)
event = Event(
@ -38,4 +37,5 @@ while True:
relay_manager.publish_event(event)
# relay_manager.close_connections() # NEEDED?!
old_block_height = block_height
time.sleep(60)
time.sleep(5)