Allow clients to transmit payments

This commit is contained in:
2024-03-20 22:59:44 +01:00
parent c6394d2ca1
commit 54c81810ee
3 changed files with 12 additions and 3 deletions

View File

@@ -360,6 +360,15 @@ def receiver(node, b):
}
identifier = (addr[0:2], "transaction")
receive_observer.publish(identifier, event_obj)
elif msg_type == 9:
# payment request
if msg_len != 153:
log(f"Got a payment of wrong length ({msg_len} bytes from {sender}, but expected 153 bytes)")
continue
parsed_transaction = blockchain.Transaction.from_bytes(msg[5:153])
if not parsed_transaction.is_valid():
continue
b.open_transactions.add(parsed_transaction)
else:
log(f"Got a udp message of unknown type from {sender}. (type {msg_type})")