Skip to content

Commit

Permalink
Namecoin / AuxPoW: Improve exception safety of auxpow.fast_tx_deseria…
Browse files Browse the repository at this point in the history
…lize.
  • Loading branch information
JeremyRand committed Jul 4, 2018
1 parent fb60f94 commit fbfaef2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/auxpow.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ def stub_parse_output(vds, i):
def fast_tx_deserialize(tx):
# Monkeypatch output address parsing with a stub, since we only care about
# inputs.
real_parse_output = transaction.parse_output
transaction.parse_output = stub_parse_output
real_parse_output, transaction.parse_output = transaction.parse_output, stub_parse_output

result = tx.deserialize()

# Restore the real output address parser.
transaction.parse_output = real_parse_output
try:
result = tx.deserialize()
finally:
# Restore the real output address parser.
transaction.parse_output = real_parse_output

return result

0 comments on commit fbfaef2

Please sign in to comment.