MultiChain / multichain-explorer

Web-based explorer for MultiChain blockchains
GNU Affero General Public License v3.0
177 stars 140 forks source link

Traceback while running the multichain Explorer #7

Closed harwinder closed 8 years ago

harwinder commented 8 years ago

Hi,

I tried running the explorer using the docker images at link:

https://github.com/Kunstmaan/docker-multichain

However, I'm running into an error where the explorer would keep giving the following stacktrace:

Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "/root/.local/lib/python2.7/site-packages/Mce/abe.py", line 319, in call handler(page) File "/root/.local/lib/python2.7/site-packages/Mce/abe.py", line 507, in handle_chains body += abe.create_recent_table(page, chain) File "/root/.local/lib/python2.7/site-packages/Mce/abe.py", line 541, in create_recent_table sorted_recenttx = sorted(recenttx, key=lambda tx: tx['time'], reverse=True) File "/root/.local/lib/python2.7/site-packages/Mce/abe.py", line 541, in sorted_recenttx = sorted(recenttx, key=lambda tx: tx['time'], reverse=True) KeyError: 'time'

bitcartel commented 8 years ago

Tx should be a transaction. It should have a 'time' field. To print out the txs, try modifying code at line 540 of Mce/abe.py to look like this:

        if len(sorted_mempool) < 10:
            import json
            print "\n\nRecent Tx = \n{0}\n\n".format( json.dumps(recenttx, sort_keys=True, indent=2))
            sorted_recenttx = sorted(recenttx, key=lambda tx: tx['time'], reverse=True)
harwinder commented 8 years ago

I printed it out, as suggested. Here is the output.

bitcartel commented 8 years ago

Thanks, the unconfirmed tx doesn't have a time field. I will have to check and see why unconfirmed tx are appearing in the database in the first place, but for now, please modify Mce/Datastore.py at line 3842 to look like this:

                json = store.get_rawtransaction_decoded(chain, txid)
                if json is not None and json['confirmations']>0:
                    result.append(json)

Let me know how you get on. I will commit this code if it resolves your problem.

harwinder commented 8 years ago

Thanks for your help. It did resolve the problem.