Browse Source

Fix bugs

master
Neil Booth 8 years ago
parent
commit
b5d1f401fd
  1. 5
      server/block_processor.py
  2. 4
      server/protocol.py

5
server/block_processor.py

@ -222,7 +222,8 @@ class MemPool(LoggedClass):
.format(hash_to_str(txin.prev_hash),
txin.prev_idx))
raise MissingUTXOError
return (entry[:21], struct.unpack('<Q', entry[-8:])), False
value, = struct.unpack('<Q', entry[-8:])
return (entry[:21], value), False
# Now add the inputs
for hex_hash, tx in new_txs.items():
@ -269,7 +270,7 @@ class MemPool(LoggedClass):
'''
value = 0
for tx_hash in self.hash168s[hash168]:
txin_pairs, txout_pairs, unconfirmed = self.txs[hex_hash]
txin_pairs, txout_pairs, unconfirmed = self.txs[tx_hash]
value -= sum(v for h168, v in txin_pairs if h168 == hash168)
value += sum(v for h168, v in txout_pairs if h168 == hash168)
return value

4
server/protocol.py

@ -310,8 +310,8 @@ class ElectrumX(JSONRPC):
conf = tuple({'tx_hash': hash_to_str(tx_hash), 'height': height}
for tx_hash, height in history)
unconf = tuple({'tx_hash': hex, 'height': -unconfirmed, 'fee': fee}
for hex, tx_fee, unconfirmed in mempool)
unconf = tuple({'tx_hash': tx_hash, 'height': -unconfirmed, 'fee': fee}
for tx_hash, fee, unconfirmed in mempool)
return conf + unconf
@classmethod

Loading…
Cancel
Save