commit ceba4af01a86762422c484ac31ca2057a83d338c
parent 9ebeb5115315ba5cb5170425c1e9ebbbe9da41b8
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 2 Jul 2018 21:38:39 +0200
synchronizer: test txid of received tx
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/synchronizer.py b/lib/synchronizer.py
@@ -150,13 +150,16 @@ class Synchronizer(ThreadJob):
if not params:
return
tx_hash = params[0]
- #assert tx_hash == hash_encode(Hash(bytes.fromhex(result)))
tx = Transaction(result)
try:
tx.deserialize()
except Exception:
self.print_msg("cannot deserialize transaction, skipping", tx_hash)
return
+ if tx_hash != tx.txid():
+ self.print_error("received tx does not match expected txid ({} != {})"
+ .format(tx_hash, tx.txid()))
+ return
tx_height = self.requested_tx.pop(tx_hash)
self.wallet.receive_tx_callback(tx_hash, tx, tx_height)
self.print_error("received tx %s height: %d bytes: %d" %