X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=backends%2Fbitcoind%2Fdeserialize.py;h=60af334f6e8889dfab53a294da1cc3a37cefdfcd;hb=9526ce60749182cea0be7da5838fa04e3d59e0f1;hp=613fa7c050fc8316d679a993c4fe0093ffd5342f;hpb=90048f3e16aa5fe35f4d1ce073146f245189d46a;p=electrum-server.git diff --git a/backends/bitcoind/deserialize.py b/backends/bitcoind/deserialize.py index 613fa7c..60af334 100644 --- a/backends/bitcoind/deserialize.py +++ b/backends/bitcoind/deserialize.py @@ -289,8 +289,13 @@ def parse_Transaction(vds, is_coinbase): d['outputs'] = [] for i in xrange(n_vout): o = parse_TxOut(vds, i) - if o['address'] != "(None)": - d['outputs'].append(o) + + #if o['address'] == "None" and o['value']==0: + # print("skipping strange tx output with zero value") + # continue + # if o['address'] != "None": + d['outputs'].append(o) + d['lockTime'] = vds.read_uint32() return d @@ -386,11 +391,22 @@ def extract_public_key(bytes): if match_decoded(decoded, match): return public_key_to_bc_address(decoded[0][1]) + # coins sent to black hole + # DUP HASH160 20 BYTES:... EQUALVERIFY CHECKSIG + match = [ opcodes.OP_DUP, opcodes.OP_HASH160, opcodes.OP_0, opcodes.OP_EQUALVERIFY, opcodes.OP_CHECKSIG ] + if match_decoded(decoded, match): + return "None" + # Pay-by-Bitcoin-address TxOuts look like: # DUP HASH160 20 BYTES:... EQUALVERIFY CHECKSIG match = [ opcodes.OP_DUP, opcodes.OP_HASH160, opcodes.OP_PUSHDATA4, opcodes.OP_EQUALVERIFY, opcodes.OP_CHECKSIG ] if match_decoded(decoded, match): return hash_160_to_bc_address(decoded[2][1]) + # strange tx + match = [ opcodes.OP_DUP, opcodes.OP_HASH160, opcodes.OP_PUSHDATA4, opcodes.OP_EQUALVERIFY, opcodes.OP_CHECKSIG, opcodes.OP_NOP ] + if match_decoded(decoded, match): + return hash_160_to_bc_address(decoded[2][1]) + #raise BaseException("address not found in script") see ce35795fb64c268a52324b884793b3165233b1e6d678ccaadf760628ec34d76b - return "(None)" + return "None"