mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Rebase/feat/586/integrate tx model (#641)
* Adjust imports to bigchaindb_common * Adjust get_spent function signature * Adjust block serialization * Fix BigchainApi Test * Fix TestTransactionValidation tests * Fix TestBlockValidation tests * WIP: TestMultipleInputs * Adjust tests to tx-model interface changes - Fix old tests - Fix tests in TestMultipleInputs class * Remove fulfillment message tests * Fix TransactionMalleability tests * Remove Cryptoconditions tests * Remove create_transaction * Remove signing logic * Remove consensus plugin * Fix block_creation pipeline * Fix election pipeline * Replace some util functions with bdb_common ones - timestamp ==> gen_timestamp - serialize. * Implement Block model * Simplify function signatures for vote functions Change parameter interface for the following functions: - has_previous_vote - verify_vote_signature - block_election_status so that they take a block's id and voters instead of a fake block. * Integrate Block and Transaction model * Fix leftover tests and cleanup conftest * Add bigchaindb-common to install_requires * Delete transactions after block is written (#609) * delete transactions after block is written * cleanup transaction_exists * check for duplicate transactions * delete invalid tx from backlog * test duplicate transaction * Remove dead code * Test processes.py * Test invalid tx in on server * Fix tests for core.py * Fix models tests * Test commands main fn * Add final coverage to vote pipeline * Add more tests to voting pipeline * Remove consensus plugin docs and misc * Post rebase fixes * Fix rebase mess * Remove extra blank line * Improve docstring * Remove comment handled in bigchaindb/cryptoconditions#27; see https://github.com/bigchaindb/cryptoconditions/issues/27 * Fix block serialization in block creation * Add signed_ prefix to transfer_tx * Improve docs * Add library documentation page on pipelines * PR feedback for models.py * Impr. readability of get_last_voted_block * Use dict comprehension * Add docker-compose file to build and serve docs locally for development purposes * Change private_key for signing_key * Improve docstrings * Remove consensus docs * Document new consensus module * Create different transactions for the block * Cleanup variable names in block.py * Create different transactions for the block * Cleanup variable names in block.py
This commit is contained in:
committed by
GitHub
parent
e74b4ee528
commit
50b0b3cef2
@@ -2,6 +2,7 @@ import json
|
||||
from time import sleep
|
||||
|
||||
import cryptoconditions as cc
|
||||
from bigchaindb_common.util import gen_timestamp
|
||||
|
||||
from bigchaindb import Bigchain, util, crypto, exceptions
|
||||
|
||||
@@ -315,7 +316,7 @@ tx_timeout = b.create_transaction(b.me, None, None, 'CREATE')
|
||||
|
||||
# Set expiry time (12 secs from now)
|
||||
time_sleep = 12
|
||||
time_expire = str(float(util.timestamp()) + time_sleep)
|
||||
time_expire = str(float(gen_timestamp()) + time_sleep)
|
||||
|
||||
# only valid if the server time <= time_expire
|
||||
condition_timeout = cc.TimeoutFulfillment(expire_time=time_expire)
|
||||
@@ -355,7 +356,7 @@ tx_timeout_transfer['transaction']['fulfillments'][0]['fulfillment'] = timeout_f
|
||||
# no need to sign transaction, like with hashlocks
|
||||
for i in range(time_sleep - 4):
|
||||
tx_timeout_valid = b.is_valid_transaction(tx_timeout_transfer) == tx_timeout_transfer
|
||||
seconds_to_timeout = int(float(time_expire) - float(util.timestamp()))
|
||||
seconds_to_timeout = int(float(time_expire) - float(gen_timestamp()))
|
||||
print('tx_timeout valid: {} ({}s to timeout)'.format(tx_timeout_valid, seconds_to_timeout))
|
||||
sleep(1)
|
||||
|
||||
@@ -370,7 +371,7 @@ tx_escrow = b.create_transaction(testuser2_pub, [testuser2_pub, testuser1_pub],
|
||||
|
||||
# Set expiry time (12 secs from now)
|
||||
time_sleep = 12
|
||||
time_expire = str(float(util.timestamp()) + time_sleep)
|
||||
time_expire = str(float(gen_timestamp()) + time_sleep)
|
||||
|
||||
# Create escrow and timeout condition
|
||||
condition_escrow = cc.ThresholdSha256Fulfillment(threshold=1) # OR Gate
|
||||
@@ -486,6 +487,6 @@ for i in range(time_sleep - 4):
|
||||
valid_execute = b.is_valid_transaction(tx_escrow_execute) == tx_escrow_execute
|
||||
valid_abort = b.is_valid_transaction(tx_escrow_abort) == tx_escrow_abort
|
||||
|
||||
seconds_to_timeout = int(float(time_expire) - float(util.timestamp()))
|
||||
seconds_to_timeout = int(float(time_expire) - float(gen_timestamp()))
|
||||
print('tx_execute valid: {} - tx_abort valid {} ({}s to timeout)'.format(valid_execute, valid_abort, seconds_to_timeout))
|
||||
sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user