From: ThomasV Date: Sat, 25 Jan 2014 10:27:20 +0000 (+0100) Subject: compute and send utxo_root with header X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=commitdiff_plain;h=bea9f00bb679409a446ec7cf78a3b6aa905e2417 compute and send utxo_root with header --- diff --git a/backends/bitcoind/blockchain_processor.py b/backends/bitcoind/blockchain_processor.py index 09644b9..18117fa 100644 --- a/backends/bitcoind/blockchain_processor.py +++ b/backends/bitcoind/blockchain_processor.py @@ -661,8 +661,8 @@ class BlockchainProcessor(Processor): prev_root_hash = None - self.header = self.block2header(self.bitcoind('getblock', [self.storage.last_hash])) + self.header['utxo_root'] = self.storage.get_root_hash().encode('hex') if self.shared.stopped(): print_log( "closing database" ) diff --git a/backends/bitcoind/storage.py b/backends/bitcoind/storage.py index 691b400..36f1366 100644 --- a/backends/bitcoind/storage.py +++ b/backends/bitcoind/storage.py @@ -22,7 +22,6 @@ class Storage(object): self.shared = shared self.hash_list = {} self.parents = {} - self.root_hash = None self.test_reorgs = test_reorgs try: @@ -55,6 +54,11 @@ class Storage(object): return + # compute root hash + d = self.get_node('') + self.root_hash, v = self.get_node_hash('',d,None) + print_log("UTXO tree root hash:", self.root_hash.encode('hex')) + print_log("Coins in database:", v) # convert between bitcoin addresses and 20 bytes keys used for storage. def address_to_key(self, addr):