Remove old code

This commit is contained in:
vrde 2016-08-01 22:55:17 +02:00
parent 199e8633bb
commit cdcb6b4e1e
No known key found for this signature in database
GPG Key ID: 6581C7C39B3D397D
2 changed files with 18 additions and 16 deletions

View File

@ -4,9 +4,9 @@ import multiprocessing as mp
import rethinkdb as r
import bigchaindb
from bigchaindb.pipelines import block
from bigchaindb.pipelines import block, vote
from bigchaindb import Bigchain
from bigchaindb.voter import Voter, Election
from bigchaindb.voter import Election
from bigchaindb.block import BlockDeleteRevert
from bigchaindb.web import server
@ -30,7 +30,6 @@ class Processes(object):
def __init__(self):
# initialize the class
self.q_new_block = mp.Queue()
self.q_block_new_vote = mp.Queue()
self.q_revert_delete = mp.Queue()
@ -43,12 +42,8 @@ class Processes(object):
for change in r.table('bigchain').changes().run(b.conn):
# insert
if change['old_val'] is None:
self.q_new_block.put(change['new_val'])
# delete
elif change['new_val'] is None:
if change['new_val'] is None:
# this should never happen in regular operation
self.q_revert_delete.put(change['old_val'])
@ -69,21 +64,18 @@ class Processes(object):
# initialize the processes
p_map_bigchain = mp.Process(name='bigchain_mapper', target=self.map_bigchain)
p_block_delete_revert = mp.Process(name='block_delete_revert', target=delete_reverter.start)
p_voter = Voter(self.q_new_block)
p_election = Election(self.q_block_new_vote)
# start the processes
logger.info('starting bigchain mapper')
p_map_bigchain.start()
logger.info('starting backlog mapper')
logger.info('starting block')
block.start()
p_block_delete_revert.start()
logger.info('starting voter')
p_voter.start()
vote.start()
logger.info('starting election')
p_election.start()
# start message
p_voter.initialized.wait()
logger.info(BANNER.format(bigchaindb.config['server']['bind']))

View File

@ -1,6 +1,6 @@
import pytest
from pytest import patch
import rethinkdb as r
from multipipes import Pipe
from multipipes import Pipe, Pipeline
from bigchaindb import util
from bigchaindb import crypto
@ -208,9 +208,8 @@ def test_valid_block_voting_with_transfer_transactions(monkeypatch, b):
assert crypto.VerifyingKey(b.me).verify(util.serialize(vote_doc['vote']),
vote_doc['signature']) is True
vote2_rs = r.table('votes').get_all([block2['id'], b.me],
index='block_and_voter').run(b.conn)
index='block_and_voter').run(b.conn)
vote2_doc = vote2_rs.next()
assert vote2_out['vote'] == vote2_doc['vote']
assert vote2_doc['vote'] == {'voting_for_block': block2['id'],
@ -256,3 +255,14 @@ def test_invalid_block_voting(monkeypatch, b, user_vk):
assert vote_doc['node_pubkey'] == b.me
assert crypto.VerifyingKey(b.me).verify(util.serialize(vote_doc['vote']),
vote_doc['signature']) is True
@patch.object(Pipeline, 'start')
def test_start(mock_start):
# TODO: `block.start` is just a wrapper around `vote.create_pipeline`,
# that is tested by `test_full_pipeline`.
# If anyone has better ideas on how to test this, please do a PR :)
from bigchaindb.pipelines import vote
vote.start()
mock_start.assert_called_with()