Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ============================= test session starts ==============================
- platform linux -- Python 3.3.2 -- pytest-2.5.1
- collected 33 items
- dist/counterpartyd/test/test_.py ..FFFFFFFFFFFFFFFFFFFFFFFF...FFF.
- =================================== FAILURES ===================================
- __________________________________ test_burn ___________________________________
- def test_burn ():
- unsigned_tx_hex = burn.create(db, source_default, int(.62 * quantity))
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:141:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff02800bb203000000001976a914a11b66a67b3ff69671c8f82254099faf374b800e88ac842c3808000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- parse_hex_cursor = db.cursor()
- tx_hash = hashlib.sha256(chr(tx_index).encode('utf-8')).hexdigest()
- global tx_index
- parse_hex_cursor.execute('''INSERT INTO transactions(
- tx_index,
- tx_hash,
- block_index,
- block_time,
- source,
- destination,
- btc_amount,
- fee,
- data) VALUES(?,?,?,?,?,?,?,?,?)''',
- (tx_index,
- tx_hash,
- tx_index,
- tx_index,
- source,
- destination,
- btc_amount,
- fee,
- data)
- )
- parse_hex_cursor.execute('''SELECT * FROM transactions \
- WHERE tx_index=?''', (tx_index,))
- tx = parse_hex_cursor.fetchall()[0]
- heaps = blocks.init_heaps(db)
- > blocks.parse_tx(db, tx, heaps)
- dist/counterpartyd/test/test_.py:83:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- tx = {'block_index': 0, 'block_time': 0, 'btc_amount': None, 'data': None, ...}
- heaps = ([], [], [], [])
- def parse_tx (db, tx, heaps):
- order_heap, order_match_heap, bet_heap, bet_match_heap = heaps
- parse_tx_cursor = db.cursor()
- # Burns.
- if tx['destination'] == config.UNSPENDABLE:
- burn.parse(db, tx)
- return
- try:
- message_type_id = struct.unpack(config.TXTYPE_FORMAT, tx['data'][:4])[0]
- except:
- # Mark transaction as of unsupported type.
- message_type_id = None
- > message = tx['data'][4:]
- E TypeError: 'NoneType' object is not subscriptable
- dist/counterpartyd/lib/blocks.py:34: TypeError
- __________________________________ test_send ___________________________________
- def test_send ():
- > unsigned_tx_hex = send.create(db, source_default, destination_default, small, 'XCP')
- dist/counterpartyd/test/test_.py:146:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
- destination = 'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7', amount = 50000000
- asset = 'XCP', unsigned = False
- def create (db, source, destination, amount, asset, unsigned=False):
- balances = util.get_balances(db, address=source, asset=asset)
- if not balances or balances[0]['amount'] < amount:
- > raise exceptions.SendError('insufficient funds')
- E lib.exceptions.SendError: insufficient funds
- dist/counterpartyd/lib/send.py:26: SendError
- ______________________________ test_order_buy_xcp ______________________________
- def test_order_buy_xcp ():
- unsigned_tx_hex = order.create(db, source_default, 'BTC', small, 'XCP', small * 2, expiration, 0, fee_provided)
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:155:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff036c2a0000000000004751210...0a00000000000000000000000000000000000052aefcc7da0b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- dist/counterpartyd/test/test_.py:54:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tx = {'locktime': 0, 'txid': '0eb5239baf02291f706f66d5bd8f5bacf70c881fcf9e1036b36feedfae571afc', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
- def get_tx_info (tx):
- """
- The destination, if it exists, always comes before the data output; the
- change, if it exists, always comes after.
- """
- # Fee is the input values minus output values.
- fee = D(0)
- # Get destination output and data output.
- destination, btc_amount, data = None, None, b''
- for vout in tx['vout']:
- fee -= D(vout['value']) * config.UNIT
- # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
- asm = vout['scriptPubKey']['asm'].split(' ')
- if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
- try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
- except binascii.Error: continue
- data += data_chunk
- elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
- try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
- except binascii.Error: continue
- data_chunk_length = data_pubkey[0] # No ord() necessary.
- data_chunk = data_pubkey[1:data_chunk_length + 1]
- data += data_chunk
- # Destination is the first output before the data.
- if not destination and not btc_amount and not data:
- if 'addresses' in vout['scriptPubKey']:
- address = vout['scriptPubKey']['addresses'][0]
- try: # If address is valid…
- bitcoin.base58_decode(address, config.ADDRESSVERSION)
- destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
- continue
- except:
- pass
- # Check for, and strip away, prefix (except for burns).
- if destination == config.UNSPENDABLE:
- pass
- elif data[:len(config.PREFIX)] == config.PREFIX:
- data = data[len(config.PREFIX):]
- else:
- return b'', None, None, None, None
- # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
- if not data and destination != config.UNSPENDABLE:
- return b'', None, None, None, None
- # Collect all possible source addresses; ignore coinbase transactions.
- source_list = []
- for vin in tx['vin']: # Loop through input transactions.
- if 'coinbase' in vin: return b'', None, None, None, None
- > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
- dist/counterpartyd/lib/blocks.py:477:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- method = 'getrawtransaction'
- params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
- def rpc (method, params):
- headers = {'content-type': 'application/json'}
- payload = {
- "method": method,
- "params": params,
- "jsonrpc": "2.0",
- "id": 0,
- }
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
- CURR_DIR += '/../test/'
- open(CURR_DIR + '/rpc.new', 'a') as f
- f.write(payload)
- '''
- response = connect(config.BITCOIND_RPC, payload, headers)
- if response == None:
- if config.TESTNET: network = 'testnet'
- else: network = 'mainnet'
- raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
- if response.status_code not in (200, 500):
- raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- print(response)
- f.close()
- '''
- # Return result, with error handling.
- response_json = response.json()
- if 'error' not in response_json.keys() or response_json['error'] == None:
- return response_json['result']
- elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
- > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
- E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
- dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
- _____________________________ test_order_sell_xcp ______________________________
- def test_order_sell_xcp ():
- > unsigned_tx_hex = order.create(db, source_default, 'XCP', round(small * 2.1), 'BTC', small, expiration, fee_required, config.MIN_FEE)
- dist/counterpartyd/test/test_.py:160:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', give_asset = 'XCP'
- give_amount = 105000000, get_asset = 'BTC', get_amount = 50000000
- expiration = 10, fee_required = 900000, fee_provided = 10000, unsigned = False
- def create (db, source, give_asset, give_amount, get_asset, get_amount, expiration, fee_required, fee_provided, unsigned=False):
- balances = util.get_balances(db, address=source, asset=give_asset)
- if give_asset != 'BTC' and (not balances or balances[0]['amount'] < give_amount):
- > raise exceptions.OrderError('insufficient funds')
- E lib.exceptions.OrderError: insufficient funds
- dist/counterpartyd/lib/order.py:38: OrderError
- _________________________________ test_btcpay __________________________________
- def test_btcpay ():
- order_match_id = 'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5'
- > unsigned_tx_hex = btcpay.create(db, order_match_id)
- dist/counterpartyd/test/test_.py:168:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- order_match_id = 'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5'
- unsigned = False
- def create (db, order_match_id, unsigned=False):
- tx0_hash, tx1_hash = order_match_id[:64], order_match_id[64:] # UTF-8 encoding means that the indices are doubled.
- # Try to match.
- order_match, problems = validate(db, order_match_id)
- > if problems: raise exceptions.BTCPayError(problems)
- E lib.exceptions.BTCPayError: ['invalid order match ID, dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5']
- dist/counterpartyd/lib/btcpay.py:37: BTCPayError
- ___________________________ test_issuance_divisible ____________________________
- def test_issuance_divisible ():
- unsigned_tx_hex = issuance.create(db, source_default, None, 'BBBBE', quantity * 10, True, False, 0, 0.0, '')
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:177:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- dist/counterpartyd/test/test_.py:54:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tx = {'locktime': 0, 'txid': 'caf7deb7a73838cb1068894af0d7c4ff5f2946690141f80832ad0e8a1f2c1b0d', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
- def get_tx_info (tx):
- """
- The destination, if it exists, always comes before the data output; the
- change, if it exists, always comes after.
- """
- # Fee is the input values minus output values.
- fee = D(0)
- # Get destination output and data output.
- destination, btc_amount, data = None, None, b''
- for vout in tx['vout']:
- fee -= D(vout['value']) * config.UNIT
- # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
- asm = vout['scriptPubKey']['asm'].split(' ')
- if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
- try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
- except binascii.Error: continue
- data += data_chunk
- elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
- try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
- except binascii.Error: continue
- data_chunk_length = data_pubkey[0] # No ord() necessary.
- data_chunk = data_pubkey[1:data_chunk_length + 1]
- data += data_chunk
- # Destination is the first output before the data.
- if not destination and not btc_amount and not data:
- if 'addresses' in vout['scriptPubKey']:
- address = vout['scriptPubKey']['addresses'][0]
- try: # If address is valid…
- bitcoin.base58_decode(address, config.ADDRESSVERSION)
- destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
- continue
- except:
- pass
- # Check for, and strip away, prefix (except for burns).
- if destination == config.UNSPENDABLE:
- pass
- elif data[:len(config.PREFIX)] == config.PREFIX:
- data = data[len(config.PREFIX):]
- else:
- return b'', None, None, None, None
- # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
- if not data and destination != config.UNSPENDABLE:
- return b'', None, None, None, None
- # Collect all possible source addresses; ignore coinbase transactions.
- source_list = []
- for vin in tx['vin']: # Loop through input transactions.
- if 'coinbase' in vin: return b'', None, None, None, None
- > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
- dist/counterpartyd/lib/blocks.py:477:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- method = 'getrawtransaction'
- params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
- def rpc (method, params):
- headers = {'content-type': 'application/json'}
- payload = {
- "method": method,
- "params": params,
- "jsonrpc": "2.0",
- "id": 0,
- }
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
- CURR_DIR += '/../test/'
- open(CURR_DIR + '/rpc.new', 'a') as f
- f.write(payload)
- '''
- response = connect(config.BITCOIND_RPC, payload, headers)
- if response == None:
- if config.TESTNET: network = 'testnet'
- else: network = 'mainnet'
- raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
- if response.status_code not in (200, 500):
- raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- print(response)
- f.close()
- '''
- # Return result, with error handling.
- response_json = response.json()
- if 'error' not in response_json.keys() or response_json['error'] == None:
- return response_json['result']
- elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
- > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
- E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
- dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
- ______________________ test_issuance_indivisible_callable ______________________
- def test_issuance_indivisible_callable ():
- unsigned_tx_hex = issuance.create(db, source_default, None, 'BBBCD', round(quantity / 1000), False, True, 1288855692, 0.015, 'foobar')
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:184:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- dist/counterpartyd/test/test_.py:54:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tx = {'locktime': 0, 'txid': '00b9bd7b6cbd97d1175bd2849546eba6c6e5b5ed7747e3f94712cf19824f125d', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
- def get_tx_info (tx):
- """
- The destination, if it exists, always comes before the data output; the
- change, if it exists, always comes after.
- """
- # Fee is the input values minus output values.
- fee = D(0)
- # Get destination output and data output.
- destination, btc_amount, data = None, None, b''
- for vout in tx['vout']:
- fee -= D(vout['value']) * config.UNIT
- # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
- asm = vout['scriptPubKey']['asm'].split(' ')
- if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
- try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
- except binascii.Error: continue
- data += data_chunk
- elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
- try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
- except binascii.Error: continue
- data_chunk_length = data_pubkey[0] # No ord() necessary.
- data_chunk = data_pubkey[1:data_chunk_length + 1]
- data += data_chunk
- # Destination is the first output before the data.
- if not destination and not btc_amount and not data:
- if 'addresses' in vout['scriptPubKey']:
- address = vout['scriptPubKey']['addresses'][0]
- try: # If address is valid…
- bitcoin.base58_decode(address, config.ADDRESSVERSION)
- destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
- continue
- except:
- pass
- # Check for, and strip away, prefix (except for burns).
- if destination == config.UNSPENDABLE:
- pass
- elif data[:len(config.PREFIX)] == config.PREFIX:
- data = data[len(config.PREFIX):]
- else:
- return b'', None, None, None, None
- # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
- if not data and destination != config.UNSPENDABLE:
- return b'', None, None, None, None
- # Collect all possible source addresses; ignore coinbase transactions.
- source_list = []
- for vin in tx['vin']: # Loop through input transactions.
- if 'coinbase' in vin: return b'', None, None, None, None
- > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
- dist/counterpartyd/lib/blocks.py:477:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- method = 'getrawtransaction'
- params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
- def rpc (method, params):
- headers = {'content-type': 'application/json'}
- payload = {
- "method": method,
- "params": params,
- "jsonrpc": "2.0",
- "id": 0,
- }
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
- CURR_DIR += '/../test/'
- open(CURR_DIR + '/rpc.new', 'a') as f
- f.write(payload)
- '''
- response = connect(config.BITCOIND_RPC, payload, headers)
- if response == None:
- if config.TESTNET: network = 'testnet'
- else: network = 'mainnet'
- raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
- if response.status_code not in (200, 500):
- raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- print(response)
- f.close()
- '''
- # Return result, with error handling.
- response_json = response.json()
- if 'error' not in response_json.keys() or response_json['error'] == None:
- return response_json['result']
- elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
- > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
- E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
- dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
- ___________________________ test_dividend_divisible ____________________________
- def test_dividend_divisible ():
- > unsigned_tx_hex = dividend.create(db, source_default, 6, 'BBBBE')
- dist/counterpartyd/test/test_.py:189:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', amount_per_share = 6
- asset = 'BBBBE', unsigned = False
- def create (db, source, amount_per_share, asset, unsigned=False):
- amount, problems = validate(db, source, amount_per_share, asset)
- > if problems: raise exceptions.DividendError(problems)
- E lib.exceptions.DividendError: ['no such asset, BBBBE.']
- dist/counterpartyd/lib/dividend.py:49: DividendError
- __________________________ test_dividend_indivisible ___________________________
- def test_dividend_indivisible ():
- > unsigned_tx_hex = dividend.create(db, source_default, 8, 'BBBCD')
- dist/counterpartyd/test/test_.py:196:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', amount_per_share = 8
- asset = 'BBBCD', unsigned = False
- def create (db, source, amount_per_share, asset, unsigned=False):
- amount, problems = validate(db, source, amount_per_share, asset)
- > if problems: raise exceptions.DividendError(problems)
- E lib.exceptions.DividendError: ['no such asset, BBBCD.']
- dist/counterpartyd/lib/dividend.py:49: DividendError
- ____________________________ test_broadcast_initial ____________________________
- def test_broadcast_initial ():
- unsigned_tx_hex = broadcast.create(db, source_default, 1388000000, 100, fee_multiplier_default, 'Unit Test')
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:205:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- dist/counterpartyd/test/test_.py:54:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tx = {'locktime': 0, 'txid': 'd61f2c4540faf89fc24b81e8933189b7591fde06bd12e79218b223b4592323b0', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
- def get_tx_info (tx):
- """
- The destination, if it exists, always comes before the data output; the
- change, if it exists, always comes after.
- """
- # Fee is the input values minus output values.
- fee = D(0)
- # Get destination output and data output.
- destination, btc_amount, data = None, None, b''
- for vout in tx['vout']:
- fee -= D(vout['value']) * config.UNIT
- # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
- asm = vout['scriptPubKey']['asm'].split(' ')
- if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
- try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
- except binascii.Error: continue
- data += data_chunk
- elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
- try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
- except binascii.Error: continue
- data_chunk_length = data_pubkey[0] # No ord() necessary.
- data_chunk = data_pubkey[1:data_chunk_length + 1]
- data += data_chunk
- # Destination is the first output before the data.
- if not destination and not btc_amount and not data:
- if 'addresses' in vout['scriptPubKey']:
- address = vout['scriptPubKey']['addresses'][0]
- try: # If address is valid…
- bitcoin.base58_decode(address, config.ADDRESSVERSION)
- destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
- continue
- except:
- pass
- # Check for, and strip away, prefix (except for burns).
- if destination == config.UNSPENDABLE:
- pass
- elif data[:len(config.PREFIX)] == config.PREFIX:
- data = data[len(config.PREFIX):]
- else:
- return b'', None, None, None, None
- # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
- if not data and destination != config.UNSPENDABLE:
- return b'', None, None, None, None
- # Collect all possible source addresses; ignore coinbase transactions.
- source_list = []
- for vin in tx['vin']: # Loop through input transactions.
- if 'coinbase' in vin: return b'', None, None, None, None
- > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
- dist/counterpartyd/lib/blocks.py:477:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- method = 'getrawtransaction'
- params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
- def rpc (method, params):
- headers = {'content-type': 'application/json'}
- payload = {
- "method": method,
- "params": params,
- "jsonrpc": "2.0",
- "id": 0,
- }
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
- CURR_DIR += '/../test/'
- open(CURR_DIR + '/rpc.new', 'a') as f
- f.write(payload)
- '''
- response = connect(config.BITCOIND_RPC, payload, headers)
- if response == None:
- if config.TESTNET: network = 'testnet'
- else: network = 'mainnet'
- raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
- if response.status_code not in (200, 500):
- raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- print(response)
- f.close()
- '''
- # Return result, with error handling.
- response_json = response.json()
- if 'error' not in response_json.keys() or response_json['error'] == None:
- return response_json['result']
- elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
- > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
- E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
- dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
- ______________________ test_bet_bullcfd_to_be_liquidated _______________________
- def test_bet_bullcfd_to_be_liquidated ():
- > unsigned_tx_hex = bet.create(db, source_default, source_default, 0, 1388000100, small, round(small / 2), 0.0, 15120, expiration)
- dist/counterpartyd/test/test_.py:210:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
- feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 0
- deadline = 1388000100, wager_amount = 50000000, counterwager_amount = 25000000
- target_value = 0.0, leverage = 15120, expiration = 10, unsigned = False
- def create (db, source, feed_address, bet_type, deadline, wager_amount,
- counterwager_amount, target_value, leverage, expiration, unsigned=False):
- # Check for sufficient funds.
- fee_multiplier = get_fee_multiplier(db, feed_address)
- balances = util.get_balances(db, address=source, asset='XCP')
- if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
- > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
- E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
- dist/counterpartyd/lib/bet.py:79: BetError
- ______________________ test_bet_bearcfd_to_be_liquidated _______________________
- def test_bet_bearcfd_to_be_liquidated ():
- > unsigned_tx_hex = bet.create(db, source_default, source_default, 1, 1388000100, round(small / 2), round(small * .83), 0.0, 15120, expiration)
- dist/counterpartyd/test/test_.py:217:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
- feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 1
- deadline = 1388000100, wager_amount = 25000000, counterwager_amount = 41500000
- target_value = 0.0, leverage = 15120, expiration = 10, unsigned = False
- def create (db, source, feed_address, bet_type, deadline, wager_amount,
- counterwager_amount, target_value, leverage, expiration, unsigned=False):
- # Check for sufficient funds.
- fee_multiplier = get_fee_multiplier(db, feed_address)
- balances = util.get_balances(db, address=source, asset='XCP')
- if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
- > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
- E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
- dist/counterpartyd/lib/bet.py:79: BetError
- ________________________ test_bet_bullcfd_to_be_settled ________________________
- def test_bet_bullcfd_to_be_settled ():
- > unsigned_tx_hex = bet.create(db, source_default, source_default, 0, 1388000100, small * 3, small * 7, 0.0, 5040, expiration)
- dist/counterpartyd/test/test_.py:224:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
- feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 0
- deadline = 1388000100, wager_amount = 150000000, counterwager_amount = 350000000
- target_value = 0.0, leverage = 5040, expiration = 10, unsigned = False
- def create (db, source, feed_address, bet_type, deadline, wager_amount,
- counterwager_amount, target_value, leverage, expiration, unsigned=False):
- # Check for sufficient funds.
- fee_multiplier = get_fee_multiplier(db, feed_address)
- balances = util.get_balances(db, address=source, asset='XCP')
- if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
- > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
- E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
- dist/counterpartyd/lib/bet.py:79: BetError
- ________________________ test_bet_bearcfd_to_be_settled ________________________
- def test_bet_bearcfd_to_be_settled ():
- > unsigned_tx_hex = bet.create(db, source_default, source_default, 1, 1388000100, small * 7, small * 3, 0.0, 5040, expiration)
- dist/counterpartyd/test/test_.py:231:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
- feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 1
- deadline = 1388000100, wager_amount = 350000000, counterwager_amount = 150000000
- target_value = 0.0, leverage = 5040, expiration = 10, unsigned = False
- def create (db, source, feed_address, bet_type, deadline, wager_amount,
- counterwager_amount, target_value, leverage, expiration, unsigned=False):
- # Check for sufficient funds.
- fee_multiplier = get_fee_multiplier(db, feed_address)
- balances = util.get_balances(db, address=source, asset='XCP')
- if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
- > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
- E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
- dist/counterpartyd/lib/bet.py:79: BetError
- ________________________________ test_bet_equal ________________________________
- def test_bet_equal ():
- > unsigned_tx_hex = bet.create(db, source_default, source_default, 2, 1388000200, small * 15, small * 13, 1, 5040, expiration)
- dist/counterpartyd/test/test_.py:238:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
- feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 2
- deadline = 1388000200, wager_amount = 750000000, counterwager_amount = 650000000
- target_value = 1, leverage = 5040, expiration = 10, unsigned = False
- def create (db, source, feed_address, bet_type, deadline, wager_amount,
- counterwager_amount, target_value, leverage, expiration, unsigned=False):
- # Check for sufficient funds.
- fee_multiplier = get_fee_multiplier(db, feed_address)
- balances = util.get_balances(db, address=source, asset='XCP')
- if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
- > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
- E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
- dist/counterpartyd/lib/bet.py:79: BetError
- ______________________________ test_bet_notequal _______________________________
- def test_bet_notequal ():
- > unsigned_tx_hex = bet.create(db, source_default, source_default, 3, 1388000200, small * 13, small * 15, 1, 5040, expiration)
- dist/counterpartyd/test/test_.py:245:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
- feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 3
- deadline = 1388000200, wager_amount = 650000000, counterwager_amount = 750000000
- target_value = 1, leverage = 5040, expiration = 10, unsigned = False
- def create (db, source, feed_address, bet_type, deadline, wager_amount,
- counterwager_amount, target_value, leverage, expiration, unsigned=False):
- # Check for sufficient funds.
- fee_multiplier = get_fee_multiplier(db, feed_address)
- balances = util.get_balances(db, address=source, asset='XCP')
- if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
- > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
- E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
- dist/counterpartyd/lib/bet.py:79: BetError
- ___________________________ test_broadcast_liquidate ___________________________
- def test_broadcast_liquidate ():
- unsigned_tx_hex = broadcast.create(db, source_default, 1388000050, round(100 - (.415/3) - .00001, 5), fee_multiplier_default, 'Unit Test')
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:254:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- dist/counterpartyd/test/test_.py:54:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tx = {'locktime': 0, 'txid': 'eb911159daa30c38ce428a5fe58ad829715a7c9b3c874cb8ac18fab22cfa1549', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
- def get_tx_info (tx):
- """
- The destination, if it exists, always comes before the data output; the
- change, if it exists, always comes after.
- """
- # Fee is the input values minus output values.
- fee = D(0)
- # Get destination output and data output.
- destination, btc_amount, data = None, None, b''
- for vout in tx['vout']:
- fee -= D(vout['value']) * config.UNIT
- # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
- asm = vout['scriptPubKey']['asm'].split(' ')
- if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
- try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
- except binascii.Error: continue
- data += data_chunk
- elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
- try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
- except binascii.Error: continue
- data_chunk_length = data_pubkey[0] # No ord() necessary.
- data_chunk = data_pubkey[1:data_chunk_length + 1]
- data += data_chunk
- # Destination is the first output before the data.
- if not destination and not btc_amount and not data:
- if 'addresses' in vout['scriptPubKey']:
- address = vout['scriptPubKey']['addresses'][0]
- try: # If address is valid…
- bitcoin.base58_decode(address, config.ADDRESSVERSION)
- destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
- continue
- except:
- pass
- # Check for, and strip away, prefix (except for burns).
- if destination == config.UNSPENDABLE:
- pass
- elif data[:len(config.PREFIX)] == config.PREFIX:
- data = data[len(config.PREFIX):]
- else:
- return b'', None, None, None, None
- # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
- if not data and destination != config.UNSPENDABLE:
- return b'', None, None, None, None
- # Collect all possible source addresses; ignore coinbase transactions.
- source_list = []
- for vin in tx['vin']: # Loop through input transactions.
- if 'coinbase' in vin: return b'', None, None, None, None
- > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
- dist/counterpartyd/lib/blocks.py:477:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- method = 'getrawtransaction'
- params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
- def rpc (method, params):
- headers = {'content-type': 'application/json'}
- payload = {
- "method": method,
- "params": params,
- "jsonrpc": "2.0",
- "id": 0,
- }
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
- CURR_DIR += '/../test/'
- open(CURR_DIR + '/rpc.new', 'a') as f
- f.write(payload)
- '''
- response = connect(config.BITCOIND_RPC, payload, headers)
- if response == None:
- if config.TESTNET: network = 'testnet'
- else: network = 'mainnet'
- raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
- if response.status_code not in (200, 500):
- raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- print(response)
- f.close()
- '''
- # Return result, with error handling.
- response_json = response.json()
- if 'error' not in response_json.keys() or response_json['error'] == None:
- return response_json['result']
- elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
- > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
- E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
- dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
- ____________________________ test_broadcast_settle _____________________________
- def test_broadcast_settle ():
- unsigned_tx_hex = broadcast.create(db, source_default, 1388000101, 100.343, fee_multiplier_default, 'Unit Test')
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:261:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- dist/counterpartyd/test/test_.py:54:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tx = {'locktime': 0, 'txid': '58e42c01e47f9475b97bf84ebf426ae7b127641e77182e2120766ab324e5a325', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
- def get_tx_info (tx):
- """
- The destination, if it exists, always comes before the data output; the
- change, if it exists, always comes after.
- """
- # Fee is the input values minus output values.
- fee = D(0)
- # Get destination output and data output.
- destination, btc_amount, data = None, None, b''
- for vout in tx['vout']:
- fee -= D(vout['value']) * config.UNIT
- # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
- asm = vout['scriptPubKey']['asm'].split(' ')
- if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
- try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
- except binascii.Error: continue
- data += data_chunk
- elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
- try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
- except binascii.Error: continue
- data_chunk_length = data_pubkey[0] # No ord() necessary.
- data_chunk = data_pubkey[1:data_chunk_length + 1]
- data += data_chunk
- # Destination is the first output before the data.
- if not destination and not btc_amount and not data:
- if 'addresses' in vout['scriptPubKey']:
- address = vout['scriptPubKey']['addresses'][0]
- try: # If address is valid…
- bitcoin.base58_decode(address, config.ADDRESSVERSION)
- destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
- continue
- except:
- pass
- # Check for, and strip away, prefix (except for burns).
- if destination == config.UNSPENDABLE:
- pass
- elif data[:len(config.PREFIX)] == config.PREFIX:
- data = data[len(config.PREFIX):]
- else:
- return b'', None, None, None, None
- # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
- if not data and destination != config.UNSPENDABLE:
- return b'', None, None, None, None
- # Collect all possible source addresses; ignore coinbase transactions.
- source_list = []
- for vin in tx['vin']: # Loop through input transactions.
- if 'coinbase' in vin: return b'', None, None, None, None
- > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
- dist/counterpartyd/lib/blocks.py:477:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- method = 'getrawtransaction'
- params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
- def rpc (method, params):
- headers = {'content-type': 'application/json'}
- payload = {
- "method": method,
- "params": params,
- "jsonrpc": "2.0",
- "id": 0,
- }
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
- CURR_DIR += '/../test/'
- open(CURR_DIR + '/rpc.new', 'a') as f
- f.write(payload)
- '''
- response = connect(config.BITCOIND_RPC, payload, headers)
- if response == None:
- if config.TESTNET: network = 'testnet'
- else: network = 'mainnet'
- raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
- if response.status_code not in (200, 500):
- raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- print(response)
- f.close()
- '''
- # Return result, with error handling.
- response_json = response.json()
- if 'error' not in response_json.keys() or response_json['error'] == None:
- return response_json['result']
- elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
- > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
- E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
- dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
- _____________________________ test_broadcast_equal _____________________________
- def test_broadcast_equal ():
- unsigned_tx_hex = broadcast.create(db, source_default, 1388000201, 2, fee_multiplier_default, 'Unit Test')
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:268:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- dist/counterpartyd/test/test_.py:54:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- tx = {'locktime': 0, 'txid': '638c4fcfe7c62a68db1b7115b66aab5b8072922ade1362c73f6a64b9c20b58f9', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
- def get_tx_info (tx):
- """
- The destination, if it exists, always comes before the data output; the
- change, if it exists, always comes after.
- """
- # Fee is the input values minus output values.
- fee = D(0)
- # Get destination output and data output.
- destination, btc_amount, data = None, None, b''
- for vout in tx['vout']:
- fee -= D(vout['value']) * config.UNIT
- # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
- asm = vout['scriptPubKey']['asm'].split(' ')
- if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
- try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
- except binascii.Error: continue
- data += data_chunk
- elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
- try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
- except binascii.Error: continue
- data_chunk_length = data_pubkey[0] # No ord() necessary.
- data_chunk = data_pubkey[1:data_chunk_length + 1]
- data += data_chunk
- # Destination is the first output before the data.
- if not destination and not btc_amount and not data:
- if 'addresses' in vout['scriptPubKey']:
- address = vout['scriptPubKey']['addresses'][0]
- try: # If address is valid…
- bitcoin.base58_decode(address, config.ADDRESSVERSION)
- destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
- continue
- except:
- pass
- # Check for, and strip away, prefix (except for burns).
- if destination == config.UNSPENDABLE:
- pass
- elif data[:len(config.PREFIX)] == config.PREFIX:
- data = data[len(config.PREFIX):]
- else:
- return b'', None, None, None, None
- # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
- if not data and destination != config.UNSPENDABLE:
- return b'', None, None, None, None
- # Collect all possible source addresses; ignore coinbase transactions.
- source_list = []
- for vin in tx['vin']: # Loop through input transactions.
- if 'coinbase' in vin: return b'', None, None, None, None
- > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
- dist/counterpartyd/lib/blocks.py:477:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- method = 'getrawtransaction'
- params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
- def rpc (method, params):
- headers = {'content-type': 'application/json'}
- payload = {
- "method": method,
- "params": params,
- "jsonrpc": "2.0",
- "id": 0,
- }
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
- CURR_DIR += '/../test/'
- open(CURR_DIR + '/rpc.new', 'a') as f
- f.write(payload)
- '''
- response = connect(config.BITCOIND_RPC, payload, headers)
- if response == None:
- if config.TESTNET: network = 'testnet'
- else: network = 'mainnet'
- raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
- if response.status_code not in (200, 500):
- raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
- '''
- if config.PREFIX == config.UNITTEST_PREFIX:
- print(response)
- f.close()
- '''
- # Return result, with error handling.
- response_json = response.json()
- if 'error' not in response_json.keys() or response_json['error'] == None:
- return response_json['result']
- elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
- > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
- E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
- dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
- __________________________ test_order_to_be_cancelled __________________________
- def test_order_to_be_cancelled ():
- > unsigned_tx_hex = order.create(db, source_default, 'BBBBE', small, 'XCP', small, expiration, 0, config.MIN_FEE)
- dist/counterpartyd/test/test_.py:273:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', give_asset = 'BBBBE'
- give_amount = 50000000, get_asset = 'XCP', get_amount = 50000000
- expiration = 10, fee_required = 0, fee_provided = 10000, unsigned = False
- def create (db, source, give_asset, give_amount, get_asset, get_amount, expiration, fee_required, fee_provided, unsigned=False):
- balances = util.get_balances(db, address=source, asset=give_asset)
- if give_asset != 'BTC' and (not balances or balances[0]['amount'] < give_amount):
- > raise exceptions.OrderError('insufficient funds')
- E lib.exceptions.OrderError: insufficient funds
- dist/counterpartyd/lib/order.py:38: OrderError
- _________________________________ test_cancel __________________________________
- def test_cancel ():
- > unsigned_tx_hex = cancel.create(db, 'ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2')
- dist/counterpartyd/test/test_.py:280:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- offer_hash = 'ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2'
- unsigned = False
- def create (db, offer_hash, unsigned=False):
- source, offer, problems = validate(db, offer_hash)
- > if problems: raise exceptions.CancelError(problems)
- E lib.exceptions.CancelError: ['no valid offer with that hash']
- dist/counterpartyd/lib/cancel.py:38: CancelError
- ________________________________ test_overburn _________________________________
- def test_overburn ():
- unsigned_tx_hex = burn.create(db, source_default, (1 * config.UNIT), overburn=True) # Try to burn a whole 'nother BTC.
- > parse_hex(unsigned_tx_hex)
- dist/counterpartyd/test/test_.py:289:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff0200e1f505000000001976a914a11b66a67b3ff69671c8f82254099faf374b800e88ac0457f405000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
- def parse_hex (unsigned_tx_hex):
- tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
- source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
- parse_hex_cursor = db.cursor()
- tx_hash = hashlib.sha256(chr(tx_index).encode('utf-8')).hexdigest()
- global tx_index
- parse_hex_cursor.execute('''INSERT INTO transactions(
- tx_index,
- tx_hash,
- block_index,
- block_time,
- source,
- destination,
- btc_amount,
- fee,
- data) VALUES(?,?,?,?,?,?,?,?,?)''',
- (tx_index,
- tx_hash,
- tx_index,
- tx_index,
- source,
- destination,
- btc_amount,
- fee,
- > data)
- )
- dist/counterpartyd/test/test_.py:77:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- > ???
- E apsw.ConstraintError: ConstraintError: PRIMARY KEY must be unique
- src/cursor.c:231: ConstraintError
- ______________________________ test_send_callable ______________________________
- def test_send_callable ():
- > unsigned_tx_hex = send.create(db, source_default, destination_default, 10000, 'BBBCD')
- dist/counterpartyd/test/test_.py:294:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
- destination = 'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7', amount = 10000
- asset = 'BBBCD', unsigned = False
- def create (db, source, destination, amount, asset, unsigned=False):
- balances = util.get_balances(db, address=source, asset=asset)
- if not balances or balances[0]['amount'] < amount:
- > raise exceptions.SendError('insufficient funds')
- E lib.exceptions.SendError: insufficient funds
- dist/counterpartyd/lib/send.py:26: SendError
- ________________________________ test_callback _________________________________
- def test_callback ():
- > unsigned_tx_hex = callback.create(db, source_default, .3, 'BBBCD')
- dist/counterpartyd/test/test_.py:301:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- db = <apsw.Connection object at 0x7fbb4c256258>
- source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', fraction_per_share = 0.3
- asset = 'BBBCD', unsigned = False
- def create (db, source, fraction_per_share, asset, unsigned=False):
- call_price, callback_total, outputs, problems = validate(db, source, fraction_per_share, asset, None)
- > if problems: raise exceptions.CallbackError(problems)
- E lib.exceptions.CallbackError: ['no such asset, BBBCD.']
- dist/counterpartyd/lib/callback.py:73: CallbackError
- ___________________________________ test_db ____________________________________
- def test_db():
- GOOD = CURR_DIR + '/db.dump'
- NEW = CURR_DIR + '/db.new.dump'
- with open(GOOD, 'r') as f:
- good_data = f.readlines()
- import io
- output=io.StringIO()
- shell=apsw.Shell(stdout=output, args=(config.DATABASE,))
- shell.process_command(".dump")
- with open(NEW, 'w') as f:
- lines = output.getvalue().split('\n')[8:]
- new_data = '\n'.join(lines)
- f.writelines(new_data)
- import subprocess
- > assert not subprocess.call(['diff', GOOD, NEW])
- E assert not 1
- E + where 1 = <function call at 0x7fbb4da2cc20>(['diff', '/home/jeff/counterpartyd_build/dist/counterpartyd/test/db.dump', '/home/jeff/counterpartyd_build/dist/counterpartyd/test/db.new.dump'])
- E + where <function call at 0x7fbb4da2cc20> = <module 'subprocess' from '/usr/lib/python3.3/subprocess.py'>.call
- dist/counterpartyd/test/test_.py:361: AssertionError
- ------------------------------- Captured stdout --------------------------------
- 15,19d14
- < INSERT INTO balances VALUES('mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',145431612500);
- < INSERT INTO balances VALUES('n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','XCP',4550000000);
- < INSERT INTO balances VALUES('mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',1000000000);
- < INSERT INTO balances VALUES('mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',93000);
- < INSERT INTO balances VALUES('n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','BBBCD',7000);
- 21,24c16,17
- < CREATE INDEX address_idx ON balances (address)
- < ;
- < CREATE INDEX asset_idx ON balances (asset)
- < ;
- ---
- > CREATE INDEX address_idx ON balances (address);
- > CREATE INDEX asset_idx ON balances (asset);
- 65,67d57
- < INSERT INTO bet_matches VALUES('01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546be7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6',10,'01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',11,'e7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',100,1388000100,0.0,15120,41500000,20750000,10,11,10,10,20,5000000,'Force‐Liquidated Bull');
- < INSERT INTO bet_matches VALUES('ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c9779d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4',12,'ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c977','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',13,'9d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',100,1388000100,0.0,5040,150000000,350000000,12,13,10,10,22,5000000,'Settled (CFD)');
- < INSERT INTO bet_matches VALUES('4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8',14,'4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',15,'dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',2,3,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',100,1388000200,1.0,5040,750000000,650000000,14,15,10,10,24,5000000,'Settled for NotEqual');
- 89,94d78
- < INSERT INTO bets VALUES(10,'01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b',10,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,1388000100,50000000,8500000,25000000,4250000,0.0,15120,10,20,5000000,'Valid');
- < INSERT INTO bets VALUES(11,'e7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6',11,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1,1388000100,25000000,4250000,41500000,0,0.0,15120,10,21,5000000,'Valid');
- < INSERT INTO bets VALUES(12,'ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c977',12,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,1388000100,150000000,0,350000000,0,0.0,5040,10,22,5000000,'Valid');
- < INSERT INTO bets VALUES(13,'9d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4',13,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1,1388000100,350000000,0,150000000,0,0.0,5040,10,23,5000000,'Valid');
- < INSERT INTO bets VALUES(14,'4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47',14,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',2,1388000200,750000000,0,650000000,0,1.0,5040,10,24,5000000,'Valid');
- < INSERT INTO bets VALUES(15,'dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8',15,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',3,1388000200,650000000,0,750000000,0,1.0,5040,10,25,5000000,'Valid');
- 103,104c87
- < CREATE INDEX blocks_block_index_idx ON blocks (block_index)
- < ;
- ---
- > CREATE INDEX blocks_block_index_idx ON blocks (block_index);
- 118,121d100
- < INSERT INTO broadcasts VALUES(9,'2b4c342f5433ebe591a1da77e013d1b72475562d48578dca8b84bac6651c3cb9',9,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1388000000,100.0,5000000,'Unit Test','Valid');
- < INSERT INTO broadcasts VALUES(16,'c555eab45d08845ae9f10d452a99bfcb06f74a50b988fe7e48dd323789b88ee3',16,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1388000050,99.86166,5000000,'Unit Test','Valid');
- < INSERT INTO broadcasts VALUES(17,'4a64a107f0cb32536e5bce6c98c393db21cca7f4ea187ba8c4dca8b51d4ea80a',17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1388000101,100.343,5000000,'Unit Test','Valid');
- < INSERT INTO broadcasts VALUES(18,'f299791cddd3d6664f6670842812ef6053eb6501bd6282a476bbbf3ee91e750c',18,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1388000201,2.0,5000000,'Unit Test','Valid');
- 123,124c102
- < CREATE INDEX broadcasts_block_index_idx ON broadcasts (block_index)
- < ;
- ---
- > CREATE INDEX broadcasts_block_index_idx ON broadcasts (block_index);
- 135d112
- < INSERT INTO btcpays VALUES(4,'e52d9c508c502347344d8c07ad91cbd6068afc75ff6292f062a09ca381c89e71',4,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5','Paid');
- 137,138c114
- < CREATE INDEX btcpays_block_index_idx ON btcpays (block_index)
- < ;
- ---
- > CREATE INDEX btcpays_block_index_idx ON btcpays (block_index);
- 150,151d125
- < INSERT INTO burns VALUES(0,'6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d',0,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',62000000,93000000000,'Valid');
- < INSERT INTO burns VALUES(21,'2f0fd1e89b8de1d57292742ec380ea47066e307ad645f5bc3adad8a06ff58608',21,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',38000000,57000000000,'Valid');
- 153,154c127
- < CREATE INDEX validity_idx ON burns (validity)
- < ;
- ---
- > CREATE INDEX validity_idx ON burns (validity);
- 166d138
- < INSERT INTO callbacks VALUES(23,'8f11b05da785e43e713d03774c6bd3405d99cd3024af334ffd68db663aa37034',23,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','0.3','BBBCD','Valid');
- 177d148
- < INSERT INTO cancels VALUES(20,'83891d7fe85c33e52c8b4e5814c92fb6a3b9467299200538a6babaa8b452d879',20,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2','Valid');
- 179,180c150
- < CREATE INDEX cancels_block_index_idx ON cancels (block_index)
- < ;
- ---
- > CREATE INDEX cancels_block_index_idx ON cancels (block_index);
- 189,207d158
- < INSERT INTO credits VALUES(0,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',93000000000);
- < INSERT INTO credits VALUES(1,'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','XCP',50000000);
- < INSERT INTO credits VALUES(4,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',100000000);
- < INSERT INTO credits VALUES(5,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',1000000000);
- < INSERT INTO credits VALUES(6,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',100000);
- < INSERT INTO credits VALUES(7,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',60);
- < INSERT INTO credits VALUES(8,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',800000);
- < INSERT INTO credits VALUES(16,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',62250000);
- < INSERT INTO credits VALUES(16,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',3112500);
- < INSERT INTO credits VALUES(17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',184300000);
- < INSERT INTO credits VALUES(17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',315700000);
- < INSERT INTO credits VALUES(17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',25000000);
- < INSERT INTO credits VALUES(18,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',1400000000);
- < INSERT INTO credits VALUES(18,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',70000000);
- < INSERT INTO credits VALUES(20,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',50000000);
- < INSERT INTO credits VALUES(21,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',57000000000);
- < INSERT INTO credits VALUES(22,'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','BBBCD',10000);
- < INSERT INTO credits VALUES(23,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',3000);
- < INSERT INTO credits VALUES(23,'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','XCP',4500000000);
- 209,210c160
- < CREATE INDEX credits_address_idx ON credits (address)
- < ;
- ---
- > CREATE INDEX credits_address_idx ON credits (address);
- 219,238d168
- < INSERT INTO debits VALUES(1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',50000000);
- < INSERT INTO debits VALUES(3,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',105000000);
- < INSERT INTO debits VALUES(7,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',60);
- < INSERT INTO debits VALUES(8,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',800000);
- < INSERT INTO debits VALUES(10,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',50000000);
- < INSERT INTO debits VALUES(10,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',2500000);
- < INSERT INTO debits VALUES(11,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',25000000);
- < INSERT INTO debits VALUES(11,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',1250000);
- < INSERT INTO debits VALUES(12,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',150000000);
- < INSERT INTO debits VALUES(12,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',7500000);
- < INSERT INTO debits VALUES(13,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',350000000);
- < INSERT INTO debits VALUES(13,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',17500000);
- < INSERT INTO debits VALUES(14,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',750000000);
- < INSERT INTO debits VALUES(14,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',37500000);
- < INSERT INTO debits VALUES(15,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',650000000);
- < INSERT INTO debits VALUES(15,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',32500000);
- < INSERT INTO debits VALUES(19,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',50000000);
- < INSERT INTO debits VALUES(22,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',10000);
- < INSERT INTO debits VALUES(23,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',4500000000);
- < INSERT INTO debits VALUES(23,'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','BBBCD',3000);
- 240,241c170
- < CREATE INDEX debits_address_idx ON debits (address)
- < ;
- ---
- > CREATE INDEX debits_address_idx ON debits (address);
- 253,254d181
- < INSERT INTO dividends VALUES(7,'ca358758f6d27e6cf45272937977a748fd88391db679ceda7dc7bf1f005ee879',7,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',6,'Valid');
- < INSERT INTO dividends VALUES(8,'beead77994cf573341ec17b58bbf7eb34d2711c993c1d976b128b3188dc1829a',8,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',8,'Valid');
- 256,257c183
- < CREATE INDEX dividends_block_index_idx ON dividends (block_index)
- < ;
- ---
- > CREATE INDEX dividends_block_index_idx ON dividends (block_index);
- 277,278d202
- < INSERT INTO issuances VALUES(5,'e77b9a9ae9e30b0dbdb6f510a264ef9de781501d7b6b92ae89eb059c5ab743db',5,'BBBBE',1000000000,1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,0,0,0.0,'',0,'Valid');
- < INSERT INTO issuances VALUES(6,'67586e98fad27da0b9968bc039a1ef34c939b9b8e523a8bef89d478608c5ecf6',6,'BBBCD',100000,0,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,1,1288855692,0.015,'foobar',0,'Valid');
- 280,281c204
- < CREATE INDEX issuances_idx ON issuances (block_index)
- < ;
- ---
- > CREATE INDEX issuances_idx ON issuances (block_index);
- 316d238
- < INSERT INTO order_matches VALUES('dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5',2,'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',3,'084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BTC',50000000,'XCP',100000000,2,3,10,10,12,'Valid');
- 318,319c240
- < CREATE INDEX match_expire_index_idx ON order_matches (match_expire_index)
- < ;
- ---
- > CREATE INDEX match_expire_index_idx ON order_matches (match_expire_index);
- 339,341d259
- < INSERT INTO orders VALUES(2,'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986',2,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BTC',50000000,0,'XCP',100000000,0,10,12,0,1000000,'Valid');
- < INSERT INTO orders VALUES(3,'084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5',3,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',105000000,5000000,'BTC',50000000,0,10,13,900000,10000,'Valid');
- < INSERT INTO orders VALUES(19,'ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2',19,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',50000000,50000000,'XCP',50000000,50000000,10,29,0,10000,'Invalid: cancelled');
- 343,346c261,262
- < CREATE INDEX block_index_idx ON orders (block_index)
- < ;
- < CREATE INDEX expire_index_idx ON orders (expire_index)
- < ;
- ---
- > CREATE INDEX block_index_idx ON orders (block_index);
- > CREATE INDEX expire_index_idx ON orders (expire_index);
- 359,360d274
- < INSERT INTO sends VALUES(1,'4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a',1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','XCP',50000000,'Valid');
- < INSERT INTO sends VALUES(22,'7cb7c4547cf2653590d7a9ace60cc623d25148adfbc88a89aeb0ef88da7839ba',22,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','BBBCD',10000,'Valid');
- 362,363c276
- < CREATE INDEX sends_block_index_idx ON sends (block_index)
- < ;
- ---
- > CREATE INDEX sends_block_index_idx ON sends (block_index);
- 378,401c291
- < INSERT INTO transactions VALUES(0,'6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d',0,0,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mvCounterpartyXXXXXXXXXXXXXXW24Hef',62000000,10000,X'',1);
- < INSERT INTO transactions VALUES(1,'4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a',1,1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7',10860,10000,X'0000000000000000000000010000000002FAF080',1);
- < INSERT INTO transactions VALUES(2,'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986',2,2,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,1000000,X'0000000A00000000000000000000000002FAF08000000000000000010000000005F5E100000A0000000000000000',1);
- < INSERT INTO transactions VALUES(3,'084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5',3,3,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000000A00000000000000010000000006422C4000000000000000000000000002FAF080000A00000000000DBBA0',1);
- < INSERT INTO transactions VALUES(4,'e52d9c508c502347344d8c07ad91cbd6068afc75ff6292f062a09ca381c89e71',4,4,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',50000000,10000,X'0000000BDBC1B4C900FFE48D575B5DA5C638040125F65DB0FE3E24494B76EA986457D986084FED08B978AF4D7D196A7446A86B58009E636B611DB16211B65A9AADFF29C5',1);
- < INSERT INTO transactions VALUES(5,'e77b9a9ae9e30b0dbdb6f510a264ef9de781501d7b6b92ae89eb059c5ab743db',5,5,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'000000140000000000004767000000003B9ACA0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
- < INSERT INTO transactions VALUES(6,'67586e98fad27da0b9968bc039a1ef34c939b9b8e523a8bef89d478608c5ecf6',6,6,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'00000014000000000000476800000000000186A000014CD2608C3C75C28F06666F6F6261720000000000000000000000000000000000000000000000000000000000000000000000',1);
- < INSERT INTO transactions VALUES(7,'ca358758f6d27e6cf45272937977a748fd88391db679ceda7dc7bf1f005ee879',7,7,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000003200000000000000060000000000004767',1);
- < INSERT INTO transactions VALUES(8,'beead77994cf573341ec17b58bbf7eb34d2711c993c1d976b128b3188dc1829a',8,8,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000003200000000000000080000000000004768',1);
- < INSERT INTO transactions VALUES(9,'2b4c342f5433ebe591a1da77e013d1b72475562d48578dca8b84bac6651c3cb9',9,9,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000001E52BB33004059000000000000004C4B4009556E69742054657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
- < INSERT INTO transactions VALUES(10,'01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b',10,10,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000052BB33640000000002FAF08000000000017D7840000000000000000000003B100000000A',1);
- < INSERT INTO transactions VALUES(11,'e7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6',11,11,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000152BB336400000000017D78400000000002793D60000000000000000000003B100000000A',1);
- < INSERT INTO transactions VALUES(12,'ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c977',12,12,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000052BB33640000000008F0D1800000000014DC93800000000000000000000013B00000000A',1);
- < INSERT INTO transactions VALUES(13,'9d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4',13,13,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000152BB33640000000014DC93800000000008F0D1800000000000000000000013B00000000A',1);
- < INSERT INTO transactions VALUES(14,'4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47',14,14,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000252BB33C8000000002CB417800000000026BE36803FF0000000000000000013B00000000A',1);
- < INSERT INTO transactions VALUES(15,'dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8',15,15,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000352BB33C80000000026BE3680000000002CB417803FF0000000000000000013B00000000A',1);
- < INSERT INTO transactions VALUES(16,'c555eab45d08845ae9f10d452a99bfcb06f74a50b988fe7e48dd323789b88ee3',16,16,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000001E52BB33324058F7256FFC115E004C4B4009556E69742054657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
- < INSERT INTO transactions VALUES(17,'4a64a107f0cb32536e5bce6c98c393db21cca7f4ea187ba8c4dca8b51d4ea80a',17,17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000001E52BB3365405915F3B645A1CB004C4B4009556E69742054657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
- < INSERT INTO transactions VALUES(18,'f299791cddd3d6664f6670842812ef6053eb6501bd6282a476bbbf3ee91e750c',18,18,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000001E52BB33C94000000000000000004C4B4009556E69742054657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
- < INSERT INTO transactions VALUES(19,'ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2',19,19,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000000A00000000000047670000000002FAF08000000000000000010000000002FAF080000A0000000000000000',1);
- < INSERT INTO transactions VALUES(20,'83891d7fe85c33e52c8b4e5814c92fb6a3b9467299200538a6babaa8b452d879',20,20,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'00000046AB897FBDEDFA502B2D839B6A56100887DCCDC507555C282E59589E06300A62E2',1);
- < INSERT INTO transactions VALUES(21,'2f0fd1e89b8de1d57292742ec380ea47066e307ad645f5bc3adad8a06ff58608',21,21,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mvCounterpartyXXXXXXXXXXXXXXW24Hef',100000000,10000,X'',1);
- < INSERT INTO transactions VALUES(22,'7cb7c4547cf2653590d7a9ace60cc623d25148adfbc88a89aeb0ef88da7839ba',22,22,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7',10860,10000,X'0000000000000000000047680000000000002710',1);
- < INSERT INTO transactions VALUES(23,'8f11b05da785e43e713d03774c6bd3405d99cd3024af334ffd68db663aa37034',23,23,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'000000153FD33333333333330000000000004768',1);
- ---
- > INSERT INTO transactions VALUES(0,'6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d',0,0,X'',NULL,NULL,NULL,NULL,1);
- 403,408c293,295
- < CREATE INDEX transactions_block_index_idx ON transactions (block_index)
- < ;
- < CREATE INDEX transactions_tx_hash_idx ON transactions (tx_hash)
- < ;
- < CREATE INDEX transactions_tx_index_idx ON transactions (tx_index)
- < ;
- ---
- > CREATE INDEX transactions_block_index_idx ON transactions (block_index);
- > CREATE INDEX transactions_tx_hash_idx ON transactions (tx_hash);
- > CREATE INDEX transactions_tx_index_idx ON transactions (tx_index);
- _________________________________ test_output __________________________________
- def test_output():
- with open(CURR_DIR + '/output.new.json', 'w') as output_new_file:
- json.dump(output_new, output_new_file, sort_keys=True, indent=4)
- for key in output_new.keys():
- try:
- assert output[key] == output_new[key]
- except Exception as e:
- print('Key:', key)
- print('Old output:')
- print(output[key])
- print('New output:')
- print(output_new[key])
- > raise e
- dist/counterpartyd/test/test_.py:376:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- def test_output():
- with open(CURR_DIR + '/output.new.json', 'w') as output_new_file:
- json.dump(output_new, output_new_file, sort_keys=True, indent=4)
- for key in output_new.keys():
- try:
- > assert output[key] == output_new[key]
- E assert [{'address': ...et': 'BBBCD'}] == []
- E Left contains more items, first extra item: {'address': 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', 'amount': 145431612500, 'asset': 'XCP'}
- dist/counterpartyd/test/test_.py:369: AssertionError
- ------------------------------- Captured stdout --------------------------------
- Key: rpc.get_balances
- Old output:
- [{'asset': 'XCP', 'amount': 145431612500, 'address': 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'}, {'asset': 'BBBBE', 'amount': 1000000000, 'address': 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'}, {'asset': 'BBBCD', 'amount': 93000, 'address': 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'}]
- New output:
- []
- ___________________________________ test_log ___________________________________
- def test_log():
- with open(CURR_DIR + '/log', 'r') as f:
- old_log = f.readlines()
- with open(CURR_DIR + '/log.new', 'r') as f:
- new_log = f.readlines()
- log_diff = list(difflib.unified_diff(old_log, new_log, n=0))
- print(log_diff)
- > assert not len(log_diff)
- E assert not 73
- E + where 73 = len(['--- \n', '+++ \n', '@@ -2,70 +1,0 @@\n', '-Credit: 930.0 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Burn: mn6q3...9ca544e6bb780a2c78901d3fb33738768511a30617afa01d)\n', '-Debit: 0.5 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', ...])
- dist/counterpartyd/test/test_.py:386: AssertionError
- ------------------------------- Captured stdout --------------------------------
- ['--- \n', '+++ \n', '@@ -2,70 +1,0 @@\n', '-Credit: 930.0 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Burn: mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc burned 0.62 BTC for 930.0 XCP (6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d)\n', '-Debit: 0.5 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 0.5 XCP to n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7\n', '-Send: 0.5 of asset XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc to n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7 (4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a)\n', '-Order: buy 0.5 BTC at 0.5000 BTC/XCP in 10 blocks, with a provided fee of 0.01 BTC and a required fee of 0.0 BTC (dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986)\n', '-Debit: 1.05 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Order: sell 1.05 XCP at 0.4762 BTC/XCP in 10 blocks, with a provided fee of 0.0001 BTC and a required fee of 0.009 BTC (084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5)\n', '-Order Match: 0.5 BTC for 1.0 XCP at 0.5000 BTC/XCP (dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5)\n', '-Credit: 1.0 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-BTC Payment for Order Match: dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5 (e52d9c508c502347344d8c07ad91cbd6068afc75ff6292f062a09ca381c89e71)\n', '-Credit: 10.0 BBBBE to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Issuance: mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc created 10.0 of divisible asset BBBBE, which is uncallable, with description ‘’ (e77b9a9ae9e30b0dbdb6f510a264ef9de781501d7b6b92ae89eb059c5ab743db)\n', '-Credit: 100000 BBBCD to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Issuance: mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc created 100000 of indivisible asset BBBCD, which is callable from 2010-11-04T03:28:12-04:00 for 0.015 XCP/BBBCD, with description ‘foobar’ (67586e98fad27da0b9968bc039a1ef34c939b9b8e523a8bef89d478608c5ecf6)\n', '-Debit: 6E-7 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 6E-7 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Dividend: mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc paid 6E-8 per share of asset BBBBE (ca358758f6d27e6cf45272937977a748fd88391db679ceda7dc7bf1f005ee879)\n', '-Debit: 0.008 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 0.008 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Dividend: mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc paid 8E-8 per share of asset BBBCD (beead77994cf573341ec17b58bbf7eb34d2711c993c1d976b128b3188dc1829a)\n', '-Broadcast: ‘Unit Test’ = 100.0 from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:33:20-05:00 with a fee multiplier of 0.0500 (2b4c342f5433ebe591a1da77e013d1b72475562d48578dca8b84bac6651c3cb9)\n', '-Debit: 0.5 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Debit: 0.025 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Bet: BullCFD on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:35:00-05:00 for 0.5 XCP against 0.25 XCP at 2.0000 odds in 10 blocks, leveraged 3.0000x for a fee of 0.025 XCP (01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b)\n', '-Debit: 0.25 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Debit: 0.0125 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Bet: BearCFD on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:35:00-05:00 for 0.25 XCP against 0.415 XCP at 0.6024 odds in 10 blocks, leveraged 3.0000x for a fee of 0.0125 XCP (e7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6)\n', '-Bet Match: BullCFD for 0.415 XCP against BearCFD for 0.2075 XCP on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:35:00-05:00, leveraged 3.0000x (01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546be7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6)\n', '-Debit: 1.5 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Debit: 0.075 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Bet: BullCFD on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:35:00-05:00 for 1.5 XCP against 3.5 XCP at 0.4286 odds in 10 blocks, leveraged 1.0000x for a fee of 0.075 XCP (ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c977)\n', '-Debit: 3.5 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Debit: 0.175 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Bet: BearCFD on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:35:00-05:00 for 3.5 XCP against 1.5 XCP at 2.3333 odds in 10 blocks, leveraged 1.0000x for a fee of 0.175 XCP (9d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4)\n', '-Bet Match: BullCFD for 1.5 XCP against BearCFD for 3.5 XCP on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:35:00-05:00, leveraged 1.0000x (ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c9779d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4)\n', '-Debit: 7.5 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Debit: 0.375 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Bet: Equal on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:36:40-05:00 for 7.5 XCP against 6.5 XCP at 1.1538 odds in 10 blocks that 1.0000, leveraged 1.0000x for a fee of 0.375 XCP (4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47)\n', '-Debit: 6.5 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Debit: 0.325 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Bet: NotEqual on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:36:40-05:00 for 6.5 XCP against 7.5 XCP at 0.8667 odds in 10 blocks that 1.0000, leveraged 1.0000x for a fee of 0.325 XCP (dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8)\n', '-Bet Match: Equal for 7.5 XCP against NotEqual for 6.5 XCP on mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:36:40-05:00 that 1.0000, leveraged 1.0000x (4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8)\n', '-Broadcast: ‘Unit Test’ = 99.86166 from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:34:10-05:00 with a fee multiplier of 0.0500 (c555eab45d08845ae9f10d452a99bfcb06f74a50b988fe7e48dd323789b88ee3)\n', '-Credit: 0.6225 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 0.031125 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Contract Force‐Liquidated: 0.0 XCP credited to the bull, 0.6225 XCP credited to the bear, and 0.031125 XCP credited to the feed address (01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546be7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6)\n', '-Broadcast: ‘Unit Test’ = 100.343 from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:35:01-05:00 with a fee multiplier of 0.0500 (4a64a107f0cb32536e5bce6c98c393db21cca7f4ea187ba8c4dca8b51d4ea80a)\n', '-Credit: 1.843 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 3.157 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 0.25 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Contract Settled: 1.843 XCP credited to the bull, 3.157 XCP credited to the bear, and 0.25 XCP credited to the feed address (ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c9779d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4)\n', '-Broadcast: ‘Unit Test’ = 2.0 from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc at 2013-12-25T14:36:41-05:00 with a fee multiplier of 0.0500 (f299791cddd3d6664f6670842812ef6053eb6501bd6282a476bbbf3ee91e750c)\n', '-Credit: 14.0 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 0.7 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Contract Settled: NotEqual won the pot of 14.0 XCP; 0.7 XCP credited to the feed address (4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8)\n', '-Debit: 0.5 BBBBE from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Order: buy 0.5 BBBBE at 1.0000 BBBBE/XCP in 10 blocks, with a provided fee of 0.0001 BTC and a required fee of 0.0 BTC (ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2)\n', '-Credit: 0.5 BBBBE to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Cancel: ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2 (83891d7fe85c33e52c8b4e5814c92fb6a3b9467299200538a6babaa8b452d879)\n', '-Credit: 570.0 XCP to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Burn: mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc burned 0.38 BTC for 570.0 XCP (2f0fd1e89b8de1d57292742ec380ea47066e307ad645f5bc3adad8a06ff58608)\n', '-Debit: 10000 BBBCD from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 10000 BBBCD to n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7\n', '-Send: 10000 of asset BBBCD from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc to n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7 (7cb7c4547cf2653590d7a9ace60cc623d25148adfbc88a89aeb0ef88da7839ba)\n', '-Debit: 45.0 XCP from mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Credit: 3000 BBBCD to mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc\n', '-Debit: 3000 BBBCD from n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7\n', '-Credit: 45.0 XCP to n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7\n', '-Callback: mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc called back 30.0% of asset BBBCD (8f11b05da785e43e713d03774c6bd3405d99cd3024af334ffd68db663aa37034)\n']
- ===================== 27 failed, 6 passed in 1.78 seconds ======================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement