Advertisement
Guest User

counterpartyd_tests_output

a guest
Feb 5th, 2014
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 96.42 KB | None | 0 0
  1. ============================= test session starts ==============================
  2. platform linux -- Python 3.3.2 -- pytest-2.5.1
  3. collected 33 items
  4.  
  5. dist/counterpartyd/test/test_.py ..FFFFFFFFFFFFFFFFFFFFFFFF...FFF.
  6.  
  7. =================================== FAILURES ===================================
  8. __________________________________ test_burn ___________________________________
  9.  
  10. def test_burn ():
  11. unsigned_tx_hex = burn.create(db, source_default, int(.62 * quantity))
  12.  
  13. > parse_hex(unsigned_tx_hex)
  14.  
  15. dist/counterpartyd/test/test_.py:141:
  16. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  17.  
  18. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff02800bb203000000001976a914a11b66a67b3ff69671c8f82254099faf374b800e88ac842c3808000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  19.  
  20. def parse_hex (unsigned_tx_hex):
  21.  
  22. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  23. source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  24.  
  25. parse_hex_cursor = db.cursor()
  26. tx_hash = hashlib.sha256(chr(tx_index).encode('utf-8')).hexdigest()
  27. global tx_index
  28. parse_hex_cursor.execute('''INSERT INTO transactions(
  29. tx_index,
  30. tx_hash,
  31. block_index,
  32. block_time,
  33. source,
  34. destination,
  35. btc_amount,
  36. fee,
  37. data) VALUES(?,?,?,?,?,?,?,?,?)''',
  38. (tx_index,
  39. tx_hash,
  40. tx_index,
  41. tx_index,
  42. source,
  43. destination,
  44. btc_amount,
  45. fee,
  46. data)
  47. )
  48. parse_hex_cursor.execute('''SELECT * FROM transactions \
  49. WHERE tx_index=?''', (tx_index,))
  50. tx = parse_hex_cursor.fetchall()[0]
  51. heaps = blocks.init_heaps(db)
  52. > blocks.parse_tx(db, tx, heaps)
  53.  
  54. dist/counterpartyd/test/test_.py:83:
  55. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  56.  
  57. db = <apsw.Connection object at 0x7fbb4c256258>
  58. tx = {'block_index': 0, 'block_time': 0, 'btc_amount': None, 'data': None, ...}
  59. heaps = ([], [], [], [])
  60.  
  61. def parse_tx (db, tx, heaps):
  62. order_heap, order_match_heap, bet_heap, bet_match_heap = heaps
  63.  
  64. parse_tx_cursor = db.cursor()
  65. # Burns.
  66. if tx['destination'] == config.UNSPENDABLE:
  67. burn.parse(db, tx)
  68. return
  69.  
  70. try:
  71. message_type_id = struct.unpack(config.TXTYPE_FORMAT, tx['data'][:4])[0]
  72. except:
  73. # Mark transaction as of unsupported type.
  74. message_type_id = None
  75.  
  76. > message = tx['data'][4:]
  77. E TypeError: 'NoneType' object is not subscriptable
  78.  
  79. dist/counterpartyd/lib/blocks.py:34: TypeError
  80. __________________________________ test_send ___________________________________
  81.  
  82. def test_send ():
  83. > unsigned_tx_hex = send.create(db, source_default, destination_default, small, 'XCP')
  84.  
  85. dist/counterpartyd/test/test_.py:146:
  86. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  87.  
  88. db = <apsw.Connection object at 0x7fbb4c256258>
  89. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
  90. destination = 'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7', amount = 50000000
  91. asset = 'XCP', unsigned = False
  92.  
  93. def create (db, source, destination, amount, asset, unsigned=False):
  94. balances = util.get_balances(db, address=source, asset=asset)
  95. if not balances or balances[0]['amount'] < amount:
  96. > raise exceptions.SendError('insufficient funds')
  97. E lib.exceptions.SendError: insufficient funds
  98.  
  99. dist/counterpartyd/lib/send.py:26: SendError
  100. ______________________________ test_order_buy_xcp ______________________________
  101.  
  102. def test_order_buy_xcp ():
  103. unsigned_tx_hex = order.create(db, source_default, 'BTC', small, 'XCP', small * 2, expiration, 0, fee_provided)
  104.  
  105. > parse_hex(unsigned_tx_hex)
  106.  
  107. dist/counterpartyd/test/test_.py:155:
  108. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  109.  
  110. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff036c2a0000000000004751210...0a00000000000000000000000000000000000052aefcc7da0b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  111.  
  112. def parse_hex (unsigned_tx_hex):
  113.  
  114. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  115. > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  116.  
  117. dist/counterpartyd/test/test_.py:54:
  118. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  119.  
  120. tx = {'locktime': 0, 'txid': '0eb5239baf02291f706f66d5bd8f5bacf70c881fcf9e1036b36feedfae571afc', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
  121.  
  122. def get_tx_info (tx):
  123. """
  124. The destination, if it exists, always comes before the data output; the
  125. change, if it exists, always comes after.
  126. """
  127.  
  128. # Fee is the input values minus output values.
  129. fee = D(0)
  130.  
  131. # Get destination output and data output.
  132. destination, btc_amount, data = None, None, b''
  133. for vout in tx['vout']:
  134. fee -= D(vout['value']) * config.UNIT
  135.  
  136. # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
  137. asm = vout['scriptPubKey']['asm'].split(' ')
  138. if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
  139. try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
  140. except binascii.Error: continue
  141. data += data_chunk
  142. elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
  143. try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
  144. except binascii.Error: continue
  145. data_chunk_length = data_pubkey[0] # No ord() necessary.
  146. data_chunk = data_pubkey[1:data_chunk_length + 1]
  147. data += data_chunk
  148.  
  149. # Destination is the first output before the data.
  150. if not destination and not btc_amount and not data:
  151. if 'addresses' in vout['scriptPubKey']:
  152. address = vout['scriptPubKey']['addresses'][0]
  153. try: # If address is valid…
  154. bitcoin.base58_decode(address, config.ADDRESSVERSION)
  155. destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
  156. continue
  157. except:
  158. pass
  159.  
  160. # Check for, and strip away, prefix (except for burns).
  161. if destination == config.UNSPENDABLE:
  162. pass
  163. elif data[:len(config.PREFIX)] == config.PREFIX:
  164. data = data[len(config.PREFIX):]
  165. else:
  166. return b'', None, None, None, None
  167.  
  168. # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
  169. if not data and destination != config.UNSPENDABLE:
  170. return b'', None, None, None, None
  171.  
  172. # Collect all possible source addresses; ignore coinbase transactions.
  173. source_list = []
  174. for vin in tx['vin']: # Loop through input transactions.
  175. if 'coinbase' in vin: return b'', None, None, None, None
  176. > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
  177.  
  178. dist/counterpartyd/lib/blocks.py:477:
  179. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  180.  
  181. method = 'getrawtransaction'
  182. params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
  183.  
  184. def rpc (method, params):
  185. headers = {'content-type': 'application/json'}
  186. payload = {
  187. "method": method,
  188. "params": params,
  189. "jsonrpc": "2.0",
  190. "id": 0,
  191. }
  192.  
  193. '''
  194. if config.PREFIX == config.UNITTEST_PREFIX:
  195. CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
  196. CURR_DIR += '/../test/'
  197. open(CURR_DIR + '/rpc.new', 'a') as f
  198. f.write(payload)
  199. '''
  200.  
  201. response = connect(config.BITCOIND_RPC, payload, headers)
  202. if response == None:
  203. if config.TESTNET: network = 'testnet'
  204. else: network = 'mainnet'
  205. raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
  206.  
  207. if response.status_code not in (200, 500):
  208. raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
  209.  
  210. '''
  211. if config.PREFIX == config.UNITTEST_PREFIX:
  212. print(response)
  213. f.close()
  214. '''
  215.  
  216. # Return result, with error handling.
  217. response_json = response.json()
  218. if 'error' not in response_json.keys() or response_json['error'] == None:
  219. return response_json['result']
  220. elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
  221. > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
  222. E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
  223.  
  224. dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
  225. _____________________________ test_order_sell_xcp ______________________________
  226.  
  227. def test_order_sell_xcp ():
  228. > unsigned_tx_hex = order.create(db, source_default, 'XCP', round(small * 2.1), 'BTC', small, expiration, fee_required, config.MIN_FEE)
  229.  
  230. dist/counterpartyd/test/test_.py:160:
  231. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  232.  
  233. db = <apsw.Connection object at 0x7fbb4c256258>
  234. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', give_asset = 'XCP'
  235. give_amount = 105000000, get_asset = 'BTC', get_amount = 50000000
  236. expiration = 10, fee_required = 900000, fee_provided = 10000, unsigned = False
  237.  
  238. def create (db, source, give_asset, give_amount, get_asset, get_amount, expiration, fee_required, fee_provided, unsigned=False):
  239. balances = util.get_balances(db, address=source, asset=give_asset)
  240. if give_asset != 'BTC' and (not balances or balances[0]['amount'] < give_amount):
  241. > raise exceptions.OrderError('insufficient funds')
  242. E lib.exceptions.OrderError: insufficient funds
  243.  
  244. dist/counterpartyd/lib/order.py:38: OrderError
  245. _________________________________ test_btcpay __________________________________
  246.  
  247. def test_btcpay ():
  248. order_match_id = 'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5'
  249. > unsigned_tx_hex = btcpay.create(db, order_match_id)
  250.  
  251. dist/counterpartyd/test/test_.py:168:
  252. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  253.  
  254. db = <apsw.Connection object at 0x7fbb4c256258>
  255. order_match_id = 'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5'
  256. unsigned = False
  257.  
  258. def create (db, order_match_id, unsigned=False):
  259. tx0_hash, tx1_hash = order_match_id[:64], order_match_id[64:] # UTF-8 encoding means that the indices are doubled.
  260.  
  261. # Try to match.
  262. order_match, problems = validate(db, order_match_id)
  263. > if problems: raise exceptions.BTCPayError(problems)
  264. E lib.exceptions.BTCPayError: ['invalid order match ID, dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5']
  265.  
  266. dist/counterpartyd/lib/btcpay.py:37: BTCPayError
  267. ___________________________ test_issuance_divisible ____________________________
  268.  
  269. def test_issuance_divisible ():
  270. unsigned_tx_hex = issuance.create(db, source_default, None, 'BBBBE', quantity * 10, True, False, 0, 0.0, '')
  271.  
  272. > parse_hex(unsigned_tx_hex)
  273.  
  274. dist/counterpartyd/test/test_.py:177:
  275. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  276.  
  277. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  278.  
  279. def parse_hex (unsigned_tx_hex):
  280.  
  281. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  282. > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  283.  
  284. dist/counterpartyd/test/test_.py:54:
  285. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  286.  
  287. tx = {'locktime': 0, 'txid': 'caf7deb7a73838cb1068894af0d7c4ff5f2946690141f80832ad0e8a1f2c1b0d', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
  288.  
  289. def get_tx_info (tx):
  290. """
  291. The destination, if it exists, always comes before the data output; the
  292. change, if it exists, always comes after.
  293. """
  294.  
  295. # Fee is the input values minus output values.
  296. fee = D(0)
  297.  
  298. # Get destination output and data output.
  299. destination, btc_amount, data = None, None, b''
  300. for vout in tx['vout']:
  301. fee -= D(vout['value']) * config.UNIT
  302.  
  303. # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
  304. asm = vout['scriptPubKey']['asm'].split(' ')
  305. if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
  306. try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
  307. except binascii.Error: continue
  308. data += data_chunk
  309. elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
  310. try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
  311. except binascii.Error: continue
  312. data_chunk_length = data_pubkey[0] # No ord() necessary.
  313. data_chunk = data_pubkey[1:data_chunk_length + 1]
  314. data += data_chunk
  315.  
  316. # Destination is the first output before the data.
  317. if not destination and not btc_amount and not data:
  318. if 'addresses' in vout['scriptPubKey']:
  319. address = vout['scriptPubKey']['addresses'][0]
  320. try: # If address is valid…
  321. bitcoin.base58_decode(address, config.ADDRESSVERSION)
  322. destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
  323. continue
  324. except:
  325. pass
  326.  
  327. # Check for, and strip away, prefix (except for burns).
  328. if destination == config.UNSPENDABLE:
  329. pass
  330. elif data[:len(config.PREFIX)] == config.PREFIX:
  331. data = data[len(config.PREFIX):]
  332. else:
  333. return b'', None, None, None, None
  334.  
  335. # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
  336. if not data and destination != config.UNSPENDABLE:
  337. return b'', None, None, None, None
  338.  
  339. # Collect all possible source addresses; ignore coinbase transactions.
  340. source_list = []
  341. for vin in tx['vin']: # Loop through input transactions.
  342. if 'coinbase' in vin: return b'', None, None, None, None
  343. > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
  344.  
  345. dist/counterpartyd/lib/blocks.py:477:
  346. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  347.  
  348. method = 'getrawtransaction'
  349. params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
  350.  
  351. def rpc (method, params):
  352. headers = {'content-type': 'application/json'}
  353. payload = {
  354. "method": method,
  355. "params": params,
  356. "jsonrpc": "2.0",
  357. "id": 0,
  358. }
  359.  
  360. '''
  361. if config.PREFIX == config.UNITTEST_PREFIX:
  362. CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
  363. CURR_DIR += '/../test/'
  364. open(CURR_DIR + '/rpc.new', 'a') as f
  365. f.write(payload)
  366. '''
  367.  
  368. response = connect(config.BITCOIND_RPC, payload, headers)
  369. if response == None:
  370. if config.TESTNET: network = 'testnet'
  371. else: network = 'mainnet'
  372. raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
  373.  
  374. if response.status_code not in (200, 500):
  375. raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
  376.  
  377. '''
  378. if config.PREFIX == config.UNITTEST_PREFIX:
  379. print(response)
  380. f.close()
  381. '''
  382.  
  383. # Return result, with error handling.
  384. response_json = response.json()
  385. if 'error' not in response_json.keys() or response_json['error'] == None:
  386. return response_json['result']
  387. elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
  388. > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
  389. E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
  390.  
  391. dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
  392. ______________________ test_issuance_indivisible_callable ______________________
  393.  
  394. def test_issuance_indivisible_callable ():
  395. unsigned_tx_hex = issuance.create(db, source_default, None, 'BBBCD', round(quantity / 1000), False, True, 1288855692, 0.015, 'foobar')
  396.  
  397. > parse_hex(unsigned_tx_hex)
  398.  
  399. dist/counterpartyd/test/test_.py:184:
  400. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  401.  
  402. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  403.  
  404. def parse_hex (unsigned_tx_hex):
  405.  
  406. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  407. > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  408.  
  409. dist/counterpartyd/test/test_.py:54:
  410. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  411.  
  412. tx = {'locktime': 0, 'txid': '00b9bd7b6cbd97d1175bd2849546eba6c6e5b5ed7747e3f94712cf19824f125d', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
  413.  
  414. def get_tx_info (tx):
  415. """
  416. The destination, if it exists, always comes before the data output; the
  417. change, if it exists, always comes after.
  418. """
  419.  
  420. # Fee is the input values minus output values.
  421. fee = D(0)
  422.  
  423. # Get destination output and data output.
  424. destination, btc_amount, data = None, None, b''
  425. for vout in tx['vout']:
  426. fee -= D(vout['value']) * config.UNIT
  427.  
  428. # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
  429. asm = vout['scriptPubKey']['asm'].split(' ')
  430. if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
  431. try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
  432. except binascii.Error: continue
  433. data += data_chunk
  434. elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
  435. try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
  436. except binascii.Error: continue
  437. data_chunk_length = data_pubkey[0] # No ord() necessary.
  438. data_chunk = data_pubkey[1:data_chunk_length + 1]
  439. data += data_chunk
  440.  
  441. # Destination is the first output before the data.
  442. if not destination and not btc_amount and not data:
  443. if 'addresses' in vout['scriptPubKey']:
  444. address = vout['scriptPubKey']['addresses'][0]
  445. try: # If address is valid…
  446. bitcoin.base58_decode(address, config.ADDRESSVERSION)
  447. destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
  448. continue
  449. except:
  450. pass
  451.  
  452. # Check for, and strip away, prefix (except for burns).
  453. if destination == config.UNSPENDABLE:
  454. pass
  455. elif data[:len(config.PREFIX)] == config.PREFIX:
  456. data = data[len(config.PREFIX):]
  457. else:
  458. return b'', None, None, None, None
  459.  
  460. # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
  461. if not data and destination != config.UNSPENDABLE:
  462. return b'', None, None, None, None
  463.  
  464. # Collect all possible source addresses; ignore coinbase transactions.
  465. source_list = []
  466. for vin in tx['vin']: # Loop through input transactions.
  467. if 'coinbase' in vin: return b'', None, None, None, None
  468. > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
  469.  
  470. dist/counterpartyd/lib/blocks.py:477:
  471. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  472.  
  473. method = 'getrawtransaction'
  474. params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
  475.  
  476. def rpc (method, params):
  477. headers = {'content-type': 'application/json'}
  478. payload = {
  479. "method": method,
  480. "params": params,
  481. "jsonrpc": "2.0",
  482. "id": 0,
  483. }
  484.  
  485. '''
  486. if config.PREFIX == config.UNITTEST_PREFIX:
  487. CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
  488. CURR_DIR += '/../test/'
  489. open(CURR_DIR + '/rpc.new', 'a') as f
  490. f.write(payload)
  491. '''
  492.  
  493. response = connect(config.BITCOIND_RPC, payload, headers)
  494. if response == None:
  495. if config.TESTNET: network = 'testnet'
  496. else: network = 'mainnet'
  497. raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
  498.  
  499. if response.status_code not in (200, 500):
  500. raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
  501.  
  502. '''
  503. if config.PREFIX == config.UNITTEST_PREFIX:
  504. print(response)
  505. f.close()
  506. '''
  507.  
  508. # Return result, with error handling.
  509. response_json = response.json()
  510. if 'error' not in response_json.keys() or response_json['error'] == None:
  511. return response_json['result']
  512. elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
  513. > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
  514. E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
  515.  
  516. dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
  517. ___________________________ test_dividend_divisible ____________________________
  518.  
  519. def test_dividend_divisible ():
  520. > unsigned_tx_hex = dividend.create(db, source_default, 6, 'BBBBE')
  521.  
  522. dist/counterpartyd/test/test_.py:189:
  523. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  524.  
  525. db = <apsw.Connection object at 0x7fbb4c256258>
  526. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', amount_per_share = 6
  527. asset = 'BBBBE', unsigned = False
  528.  
  529. def create (db, source, amount_per_share, asset, unsigned=False):
  530. amount, problems = validate(db, source, amount_per_share, asset)
  531. > if problems: raise exceptions.DividendError(problems)
  532. E lib.exceptions.DividendError: ['no such asset, BBBBE.']
  533.  
  534. dist/counterpartyd/lib/dividend.py:49: DividendError
  535. __________________________ test_dividend_indivisible ___________________________
  536.  
  537. def test_dividend_indivisible ():
  538. > unsigned_tx_hex = dividend.create(db, source_default, 8, 'BBBCD')
  539.  
  540. dist/counterpartyd/test/test_.py:196:
  541. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  542.  
  543. db = <apsw.Connection object at 0x7fbb4c256258>
  544. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', amount_per_share = 8
  545. asset = 'BBBCD', unsigned = False
  546.  
  547. def create (db, source, amount_per_share, asset, unsigned=False):
  548. amount, problems = validate(db, source, amount_per_share, asset)
  549. > if problems: raise exceptions.DividendError(problems)
  550. E lib.exceptions.DividendError: ['no such asset, BBBCD.']
  551.  
  552. dist/counterpartyd/lib/dividend.py:49: DividendError
  553. ____________________________ test_broadcast_initial ____________________________
  554.  
  555. def test_broadcast_initial ():
  556. unsigned_tx_hex = broadcast.create(db, source_default, 1388000000, 100, fee_multiplier_default, 'Unit Test')
  557.  
  558. > parse_hex(unsigned_tx_hex)
  559.  
  560. dist/counterpartyd/test/test_.py:205:
  561. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  562.  
  563. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  564.  
  565. def parse_hex (unsigned_tx_hex):
  566.  
  567. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  568. > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  569.  
  570. dist/counterpartyd/test/test_.py:54:
  571. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  572.  
  573. tx = {'locktime': 0, 'txid': 'd61f2c4540faf89fc24b81e8933189b7591fde06bd12e79218b223b4592323b0', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
  574.  
  575. def get_tx_info (tx):
  576. """
  577. The destination, if it exists, always comes before the data output; the
  578. change, if it exists, always comes after.
  579. """
  580.  
  581. # Fee is the input values minus output values.
  582. fee = D(0)
  583.  
  584. # Get destination output and data output.
  585. destination, btc_amount, data = None, None, b''
  586. for vout in tx['vout']:
  587. fee -= D(vout['value']) * config.UNIT
  588.  
  589. # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
  590. asm = vout['scriptPubKey']['asm'].split(' ')
  591. if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
  592. try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
  593. except binascii.Error: continue
  594. data += data_chunk
  595. elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
  596. try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
  597. except binascii.Error: continue
  598. data_chunk_length = data_pubkey[0] # No ord() necessary.
  599. data_chunk = data_pubkey[1:data_chunk_length + 1]
  600. data += data_chunk
  601.  
  602. # Destination is the first output before the data.
  603. if not destination and not btc_amount and not data:
  604. if 'addresses' in vout['scriptPubKey']:
  605. address = vout['scriptPubKey']['addresses'][0]
  606. try: # If address is valid…
  607. bitcoin.base58_decode(address, config.ADDRESSVERSION)
  608. destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
  609. continue
  610. except:
  611. pass
  612.  
  613. # Check for, and strip away, prefix (except for burns).
  614. if destination == config.UNSPENDABLE:
  615. pass
  616. elif data[:len(config.PREFIX)] == config.PREFIX:
  617. data = data[len(config.PREFIX):]
  618. else:
  619. return b'', None, None, None, None
  620.  
  621. # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
  622. if not data and destination != config.UNSPENDABLE:
  623. return b'', None, None, None, None
  624.  
  625. # Collect all possible source addresses; ignore coinbase transactions.
  626. source_list = []
  627. for vin in tx['vin']: # Loop through input transactions.
  628. if 'coinbase' in vin: return b'', None, None, None, None
  629. > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
  630.  
  631. dist/counterpartyd/lib/blocks.py:477:
  632. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  633.  
  634. method = 'getrawtransaction'
  635. params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
  636.  
  637. def rpc (method, params):
  638. headers = {'content-type': 'application/json'}
  639. payload = {
  640. "method": method,
  641. "params": params,
  642. "jsonrpc": "2.0",
  643. "id": 0,
  644. }
  645.  
  646. '''
  647. if config.PREFIX == config.UNITTEST_PREFIX:
  648. CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
  649. CURR_DIR += '/../test/'
  650. open(CURR_DIR + '/rpc.new', 'a') as f
  651. f.write(payload)
  652. '''
  653.  
  654. response = connect(config.BITCOIND_RPC, payload, headers)
  655. if response == None:
  656. if config.TESTNET: network = 'testnet'
  657. else: network = 'mainnet'
  658. raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
  659.  
  660. if response.status_code not in (200, 500):
  661. raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
  662.  
  663. '''
  664. if config.PREFIX == config.UNITTEST_PREFIX:
  665. print(response)
  666. f.close()
  667. '''
  668.  
  669. # Return result, with error handling.
  670. response_json = response.json()
  671. if 'error' not in response_json.keys() or response_json['error'] == None:
  672. return response_json['result']
  673. elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
  674. > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
  675. E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
  676.  
  677. dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
  678. ______________________ test_bet_bullcfd_to_be_liquidated _______________________
  679.  
  680. def test_bet_bullcfd_to_be_liquidated ():
  681. > unsigned_tx_hex = bet.create(db, source_default, source_default, 0, 1388000100, small, round(small / 2), 0.0, 15120, expiration)
  682.  
  683. dist/counterpartyd/test/test_.py:210:
  684. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  685.  
  686. db = <apsw.Connection object at 0x7fbb4c256258>
  687. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
  688. feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 0
  689. deadline = 1388000100, wager_amount = 50000000, counterwager_amount = 25000000
  690. target_value = 0.0, leverage = 15120, expiration = 10, unsigned = False
  691.  
  692. def create (db, source, feed_address, bet_type, deadline, wager_amount,
  693. counterwager_amount, target_value, leverage, expiration, unsigned=False):
  694.  
  695. # Check for sufficient funds.
  696. fee_multiplier = get_fee_multiplier(db, feed_address)
  697. balances = util.get_balances(db, address=source, asset='XCP')
  698. if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
  699. > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
  700. E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
  701.  
  702. dist/counterpartyd/lib/bet.py:79: BetError
  703. ______________________ test_bet_bearcfd_to_be_liquidated _______________________
  704.  
  705. def test_bet_bearcfd_to_be_liquidated ():
  706. > unsigned_tx_hex = bet.create(db, source_default, source_default, 1, 1388000100, round(small / 2), round(small * .83), 0.0, 15120, expiration)
  707.  
  708. dist/counterpartyd/test/test_.py:217:
  709. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  710.  
  711. db = <apsw.Connection object at 0x7fbb4c256258>
  712. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
  713. feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 1
  714. deadline = 1388000100, wager_amount = 25000000, counterwager_amount = 41500000
  715. target_value = 0.0, leverage = 15120, expiration = 10, unsigned = False
  716.  
  717. def create (db, source, feed_address, bet_type, deadline, wager_amount,
  718. counterwager_amount, target_value, leverage, expiration, unsigned=False):
  719.  
  720. # Check for sufficient funds.
  721. fee_multiplier = get_fee_multiplier(db, feed_address)
  722. balances = util.get_balances(db, address=source, asset='XCP')
  723. if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
  724. > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
  725. E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
  726.  
  727. dist/counterpartyd/lib/bet.py:79: BetError
  728. ________________________ test_bet_bullcfd_to_be_settled ________________________
  729.  
  730. def test_bet_bullcfd_to_be_settled ():
  731. > unsigned_tx_hex = bet.create(db, source_default, source_default, 0, 1388000100, small * 3, small * 7, 0.0, 5040, expiration)
  732.  
  733. dist/counterpartyd/test/test_.py:224:
  734. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  735.  
  736. db = <apsw.Connection object at 0x7fbb4c256258>
  737. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
  738. feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 0
  739. deadline = 1388000100, wager_amount = 150000000, counterwager_amount = 350000000
  740. target_value = 0.0, leverage = 5040, expiration = 10, unsigned = False
  741.  
  742. def create (db, source, feed_address, bet_type, deadline, wager_amount,
  743. counterwager_amount, target_value, leverage, expiration, unsigned=False):
  744.  
  745. # Check for sufficient funds.
  746. fee_multiplier = get_fee_multiplier(db, feed_address)
  747. balances = util.get_balances(db, address=source, asset='XCP')
  748. if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
  749. > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
  750. E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
  751.  
  752. dist/counterpartyd/lib/bet.py:79: BetError
  753. ________________________ test_bet_bearcfd_to_be_settled ________________________
  754.  
  755. def test_bet_bearcfd_to_be_settled ():
  756. > unsigned_tx_hex = bet.create(db, source_default, source_default, 1, 1388000100, small * 7, small * 3, 0.0, 5040, expiration)
  757.  
  758. dist/counterpartyd/test/test_.py:231:
  759. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  760.  
  761. db = <apsw.Connection object at 0x7fbb4c256258>
  762. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
  763. feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 1
  764. deadline = 1388000100, wager_amount = 350000000, counterwager_amount = 150000000
  765. target_value = 0.0, leverage = 5040, expiration = 10, unsigned = False
  766.  
  767. def create (db, source, feed_address, bet_type, deadline, wager_amount,
  768. counterwager_amount, target_value, leverage, expiration, unsigned=False):
  769.  
  770. # Check for sufficient funds.
  771. fee_multiplier = get_fee_multiplier(db, feed_address)
  772. balances = util.get_balances(db, address=source, asset='XCP')
  773. if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
  774. > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
  775. E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
  776.  
  777. dist/counterpartyd/lib/bet.py:79: BetError
  778. ________________________________ test_bet_equal ________________________________
  779.  
  780. def test_bet_equal ():
  781. > unsigned_tx_hex = bet.create(db, source_default, source_default, 2, 1388000200, small * 15, small * 13, 1, 5040, expiration)
  782.  
  783. dist/counterpartyd/test/test_.py:238:
  784. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  785.  
  786. db = <apsw.Connection object at 0x7fbb4c256258>
  787. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
  788. feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 2
  789. deadline = 1388000200, wager_amount = 750000000, counterwager_amount = 650000000
  790. target_value = 1, leverage = 5040, expiration = 10, unsigned = False
  791.  
  792. def create (db, source, feed_address, bet_type, deadline, wager_amount,
  793. counterwager_amount, target_value, leverage, expiration, unsigned=False):
  794.  
  795. # Check for sufficient funds.
  796. fee_multiplier = get_fee_multiplier(db, feed_address)
  797. balances = util.get_balances(db, address=source, asset='XCP')
  798. if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
  799. > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
  800. E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
  801.  
  802. dist/counterpartyd/lib/bet.py:79: BetError
  803. ______________________________ test_bet_notequal _______________________________
  804.  
  805. def test_bet_notequal ():
  806. > unsigned_tx_hex = bet.create(db, source_default, source_default, 3, 1388000200, small * 13, small * 15, 1, 5040, expiration)
  807.  
  808. dist/counterpartyd/test/test_.py:245:
  809. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  810.  
  811. db = <apsw.Connection object at 0x7fbb4c256258>
  812. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
  813. feed_address = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', bet_type = 3
  814. deadline = 1388000200, wager_amount = 650000000, counterwager_amount = 750000000
  815. target_value = 1, leverage = 5040, expiration = 10, unsigned = False
  816.  
  817. def create (db, source, feed_address, bet_type, deadline, wager_amount,
  818. counterwager_amount, target_value, leverage, expiration, unsigned=False):
  819.  
  820. # Check for sufficient funds.
  821. fee_multiplier = get_fee_multiplier(db, feed_address)
  822. balances = util.get_balances(db, address=source, asset='XCP')
  823. if not balances or balances[0]['amount']/(1 + fee_multiplier / 1e8) < wager_amount :
  824. > raise exceptions.BetError('insufficient funds to both make wager and pay feed fee (in XCP)')
  825. E lib.exceptions.BetError: insufficient funds to both make wager and pay feed fee (in XCP)
  826.  
  827. dist/counterpartyd/lib/bet.py:79: BetError
  828. ___________________________ test_broadcast_liquidate ___________________________
  829.  
  830. def test_broadcast_liquidate ():
  831. unsigned_tx_hex = broadcast.create(db, source_default, 1388000050, round(100 - (.415/3) - .00001, 5), fee_multiplier_default, 'Unit Test')
  832.  
  833. > parse_hex(unsigned_tx_hex)
  834.  
  835. dist/counterpartyd/test/test_.py:254:
  836. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  837.  
  838. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  839.  
  840. def parse_hex (unsigned_tx_hex):
  841.  
  842. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  843. > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  844.  
  845. dist/counterpartyd/test/test_.py:54:
  846. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  847.  
  848. tx = {'locktime': 0, 'txid': 'eb911159daa30c38ce428a5fe58ad829715a7c9b3c874cb8ac18fab22cfa1549', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
  849.  
  850. def get_tx_info (tx):
  851. """
  852. The destination, if it exists, always comes before the data output; the
  853. change, if it exists, always comes after.
  854. """
  855.  
  856. # Fee is the input values minus output values.
  857. fee = D(0)
  858.  
  859. # Get destination output and data output.
  860. destination, btc_amount, data = None, None, b''
  861. for vout in tx['vout']:
  862. fee -= D(vout['value']) * config.UNIT
  863.  
  864. # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
  865. asm = vout['scriptPubKey']['asm'].split(' ')
  866. if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
  867. try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
  868. except binascii.Error: continue
  869. data += data_chunk
  870. elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
  871. try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
  872. except binascii.Error: continue
  873. data_chunk_length = data_pubkey[0] # No ord() necessary.
  874. data_chunk = data_pubkey[1:data_chunk_length + 1]
  875. data += data_chunk
  876.  
  877. # Destination is the first output before the data.
  878. if not destination and not btc_amount and not data:
  879. if 'addresses' in vout['scriptPubKey']:
  880. address = vout['scriptPubKey']['addresses'][0]
  881. try: # If address is valid…
  882. bitcoin.base58_decode(address, config.ADDRESSVERSION)
  883. destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
  884. continue
  885. except:
  886. pass
  887.  
  888. # Check for, and strip away, prefix (except for burns).
  889. if destination == config.UNSPENDABLE:
  890. pass
  891. elif data[:len(config.PREFIX)] == config.PREFIX:
  892. data = data[len(config.PREFIX):]
  893. else:
  894. return b'', None, None, None, None
  895.  
  896. # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
  897. if not data and destination != config.UNSPENDABLE:
  898. return b'', None, None, None, None
  899.  
  900. # Collect all possible source addresses; ignore coinbase transactions.
  901. source_list = []
  902. for vin in tx['vin']: # Loop through input transactions.
  903. if 'coinbase' in vin: return b'', None, None, None, None
  904. > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
  905.  
  906. dist/counterpartyd/lib/blocks.py:477:
  907. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  908.  
  909. method = 'getrawtransaction'
  910. params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
  911.  
  912. def rpc (method, params):
  913. headers = {'content-type': 'application/json'}
  914. payload = {
  915. "method": method,
  916. "params": params,
  917. "jsonrpc": "2.0",
  918. "id": 0,
  919. }
  920.  
  921. '''
  922. if config.PREFIX == config.UNITTEST_PREFIX:
  923. CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
  924. CURR_DIR += '/../test/'
  925. open(CURR_DIR + '/rpc.new', 'a') as f
  926. f.write(payload)
  927. '''
  928.  
  929. response = connect(config.BITCOIND_RPC, payload, headers)
  930. if response == None:
  931. if config.TESTNET: network = 'testnet'
  932. else: network = 'mainnet'
  933. raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
  934.  
  935. if response.status_code not in (200, 500):
  936. raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
  937.  
  938. '''
  939. if config.PREFIX == config.UNITTEST_PREFIX:
  940. print(response)
  941. f.close()
  942. '''
  943.  
  944. # Return result, with error handling.
  945. response_json = response.json()
  946. if 'error' not in response_json.keys() or response_json['error'] == None:
  947. return response_json['result']
  948. elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
  949. > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
  950. E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
  951.  
  952. dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
  953. ____________________________ test_broadcast_settle _____________________________
  954.  
  955. def test_broadcast_settle ():
  956. unsigned_tx_hex = broadcast.create(db, source_default, 1388000101, 100.343, fee_multiplier_default, 'Unit Test')
  957.  
  958. > parse_hex(unsigned_tx_hex)
  959.  
  960. dist/counterpartyd/test/test_.py:261:
  961. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  962.  
  963. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  964.  
  965. def parse_hex (unsigned_tx_hex):
  966.  
  967. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  968. > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  969.  
  970. dist/counterpartyd/test/test_.py:54:
  971. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  972.  
  973. tx = {'locktime': 0, 'txid': '58e42c01e47f9475b97bf84ebf426ae7b127641e77182e2120766ab324e5a325', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
  974.  
  975. def get_tx_info (tx):
  976. """
  977. The destination, if it exists, always comes before the data output; the
  978. change, if it exists, always comes after.
  979. """
  980.  
  981. # Fee is the input values minus output values.
  982. fee = D(0)
  983.  
  984. # Get destination output and data output.
  985. destination, btc_amount, data = None, None, b''
  986. for vout in tx['vout']:
  987. fee -= D(vout['value']) * config.UNIT
  988.  
  989. # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
  990. asm = vout['scriptPubKey']['asm'].split(' ')
  991. if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
  992. try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
  993. except binascii.Error: continue
  994. data += data_chunk
  995. elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
  996. try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
  997. except binascii.Error: continue
  998. data_chunk_length = data_pubkey[0] # No ord() necessary.
  999. data_chunk = data_pubkey[1:data_chunk_length + 1]
  1000. data += data_chunk
  1001.  
  1002. # Destination is the first output before the data.
  1003. if not destination and not btc_amount and not data:
  1004. if 'addresses' in vout['scriptPubKey']:
  1005. address = vout['scriptPubKey']['addresses'][0]
  1006. try: # If address is valid…
  1007. bitcoin.base58_decode(address, config.ADDRESSVERSION)
  1008. destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
  1009. continue
  1010. except:
  1011. pass
  1012.  
  1013. # Check for, and strip away, prefix (except for burns).
  1014. if destination == config.UNSPENDABLE:
  1015. pass
  1016. elif data[:len(config.PREFIX)] == config.PREFIX:
  1017. data = data[len(config.PREFIX):]
  1018. else:
  1019. return b'', None, None, None, None
  1020.  
  1021. # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
  1022. if not data and destination != config.UNSPENDABLE:
  1023. return b'', None, None, None, None
  1024.  
  1025. # Collect all possible source addresses; ignore coinbase transactions.
  1026. source_list = []
  1027. for vin in tx['vin']: # Loop through input transactions.
  1028. if 'coinbase' in vin: return b'', None, None, None, None
  1029. > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
  1030.  
  1031. dist/counterpartyd/lib/blocks.py:477:
  1032. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1033.  
  1034. method = 'getrawtransaction'
  1035. params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
  1036.  
  1037. def rpc (method, params):
  1038. headers = {'content-type': 'application/json'}
  1039. payload = {
  1040. "method": method,
  1041. "params": params,
  1042. "jsonrpc": "2.0",
  1043. "id": 0,
  1044. }
  1045.  
  1046. '''
  1047. if config.PREFIX == config.UNITTEST_PREFIX:
  1048. CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
  1049. CURR_DIR += '/../test/'
  1050. open(CURR_DIR + '/rpc.new', 'a') as f
  1051. f.write(payload)
  1052. '''
  1053.  
  1054. response = connect(config.BITCOIND_RPC, payload, headers)
  1055. if response == None:
  1056. if config.TESTNET: network = 'testnet'
  1057. else: network = 'mainnet'
  1058. raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
  1059.  
  1060. if response.status_code not in (200, 500):
  1061. raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
  1062.  
  1063. '''
  1064. if config.PREFIX == config.UNITTEST_PREFIX:
  1065. print(response)
  1066. f.close()
  1067. '''
  1068.  
  1069. # Return result, with error handling.
  1070. response_json = response.json()
  1071. if 'error' not in response_json.keys() or response_json['error'] == None:
  1072. return response_json['result']
  1073. elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
  1074. > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
  1075. E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
  1076.  
  1077. dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
  1078. _____________________________ test_broadcast_equal _____________________________
  1079.  
  1080. def test_broadcast_equal ():
  1081. unsigned_tx_hex = broadcast.create(db, source_default, 1388000201, 2, fee_multiplier_default, 'Unit Test')
  1082.  
  1083. > parse_hex(unsigned_tx_hex)
  1084.  
  1085. dist/counterpartyd/test/test_.py:268:
  1086. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1087.  
  1088. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff046c2a0000000000004751210...0000000000000000000000000000000000000052aec0b8e90b000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  1089.  
  1090. def parse_hex (unsigned_tx_hex):
  1091.  
  1092. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  1093. > source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  1094.  
  1095. dist/counterpartyd/test/test_.py:54:
  1096. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1097.  
  1098. tx = {'locktime': 0, 'txid': '638c4fcfe7c62a68db1b7115b66aab5b8072922ade1362c73f6a64b9c20b58f9', 'version': 1, 'vin': [{'sc..., 'sequence': 4294967295, 'txid': 'ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 'vout': 0}], ...}
  1099.  
  1100. def get_tx_info (tx):
  1101. """
  1102. The destination, if it exists, always comes before the data output; the
  1103. change, if it exists, always comes after.
  1104. """
  1105.  
  1106. # Fee is the input values minus output values.
  1107. fee = D(0)
  1108.  
  1109. # Get destination output and data output.
  1110. destination, btc_amount, data = None, None, b''
  1111. for vout in tx['vout']:
  1112. fee -= D(vout['value']) * config.UNIT
  1113.  
  1114. # Sum data chunks to get data. (Can mix OP_RETURN and multi‐sig.)
  1115. asm = vout['scriptPubKey']['asm'].split(' ')
  1116. if len(asm) == 2 and asm[0] == 'OP_RETURN': # OP_RETURN
  1117. try: data_chunk = binascii.unhexlify(bytes(asm[1], 'utf-8'))
  1118. except binascii.Error: continue
  1119. data += data_chunk
  1120. elif len(asm) >= 5 and asm[0] == '1' and asm[3] == '2' and asm[4] == 'OP_CHECKMULTISIG': # Multi‐sig
  1121. try: data_pubkey = binascii.unhexlify(bytes(asm[2], 'utf-8'))
  1122. except binascii.Error: continue
  1123. data_chunk_length = data_pubkey[0] # No ord() necessary.
  1124. data_chunk = data_pubkey[1:data_chunk_length + 1]
  1125. data += data_chunk
  1126.  
  1127. # Destination is the first output before the data.
  1128. if not destination and not btc_amount and not data:
  1129. if 'addresses' in vout['scriptPubKey']:
  1130. address = vout['scriptPubKey']['addresses'][0]
  1131. try: # If address is valid…
  1132. bitcoin.base58_decode(address, config.ADDRESSVERSION)
  1133. destination, btc_amount = address, round(D(vout['value']) * config.UNIT)
  1134. continue
  1135. except:
  1136. pass
  1137.  
  1138. # Check for, and strip away, prefix (except for burns).
  1139. if destination == config.UNSPENDABLE:
  1140. pass
  1141. elif data[:len(config.PREFIX)] == config.PREFIX:
  1142. data = data[len(config.PREFIX):]
  1143. else:
  1144. return b'', None, None, None, None
  1145.  
  1146. # Only look for source if data were found (or destination is UNSPENDABLE), for speed.
  1147. if not data and destination != config.UNSPENDABLE:
  1148. return b'', None, None, None, None
  1149.  
  1150. # Collect all possible source addresses; ignore coinbase transactions.
  1151. source_list = []
  1152. for vin in tx['vin']: # Loop through input transactions.
  1153. if 'coinbase' in vin: return b'', None, None, None, None
  1154. > vin_tx = bitcoin.rpc('getrawtransaction', [vin['txid'], 1]) # Get the full transaction data for this input transaction.
  1155.  
  1156. dist/counterpartyd/lib/blocks.py:477:
  1157. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1158.  
  1159. method = 'getrawtransaction'
  1160. params = ['ae241be7be83ebb14902757ad94854f787d9730fc553d6f695346c9375c0d8c1', 1]
  1161.  
  1162. def rpc (method, params):
  1163. headers = {'content-type': 'application/json'}
  1164. payload = {
  1165. "method": method,
  1166. "params": params,
  1167. "jsonrpc": "2.0",
  1168. "id": 0,
  1169. }
  1170.  
  1171. '''
  1172. if config.PREFIX == config.UNITTEST_PREFIX:
  1173. CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
  1174. CURR_DIR += '/../test/'
  1175. open(CURR_DIR + '/rpc.new', 'a') as f
  1176. f.write(payload)
  1177. '''
  1178.  
  1179. response = connect(config.BITCOIND_RPC, payload, headers)
  1180. if response == None:
  1181. if config.TESTNET: network = 'testnet'
  1182. else: network = 'mainnet'
  1183. raise exceptions.BitcoindRPCError('Cannot communicate with Bitcoind. (counterpartyd is set to run on {}, is Bitcoind?)'.format(network))
  1184.  
  1185. if response.status_code not in (200, 500):
  1186. raise exceptions.BitcoindRPCError(str(response.status_code) + ' ' + response.reason)
  1187.  
  1188. '''
  1189. if config.PREFIX == config.UNITTEST_PREFIX:
  1190. print(response)
  1191. f.close()
  1192. '''
  1193.  
  1194. # Return result, with error handling.
  1195. response_json = response.json()
  1196. if 'error' not in response_json.keys() or response_json['error'] == None:
  1197. return response_json['result']
  1198. elif response_json['error']['code'] == -5: # RPC_INVALID_ADDRESS_OR_KEY
  1199. > raise exceptions.BitcoindError('{} Is txindex enabled in Bitcoind?'.format(response_json['error']))
  1200. E lib.exceptions.BitcoindError: {'code': -5, 'message': 'No information available about transaction'} Is txindex enabled in Bitcoind?
  1201.  
  1202. dist/counterpartyd/lib/bitcoin.py:87: BitcoindError
  1203. __________________________ test_order_to_be_cancelled __________________________
  1204.  
  1205. def test_order_to_be_cancelled ():
  1206. > unsigned_tx_hex = order.create(db, source_default, 'BBBBE', small, 'XCP', small, expiration, 0, config.MIN_FEE)
  1207.  
  1208. dist/counterpartyd/test/test_.py:273:
  1209. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1210.  
  1211. db = <apsw.Connection object at 0x7fbb4c256258>
  1212. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', give_asset = 'BBBBE'
  1213. give_amount = 50000000, get_asset = 'XCP', get_amount = 50000000
  1214. expiration = 10, fee_required = 0, fee_provided = 10000, unsigned = False
  1215.  
  1216. def create (db, source, give_asset, give_amount, get_asset, get_amount, expiration, fee_required, fee_provided, unsigned=False):
  1217. balances = util.get_balances(db, address=source, asset=give_asset)
  1218. if give_asset != 'BTC' and (not balances or balances[0]['amount'] < give_amount):
  1219. > raise exceptions.OrderError('insufficient funds')
  1220. E lib.exceptions.OrderError: insufficient funds
  1221.  
  1222. dist/counterpartyd/lib/order.py:38: OrderError
  1223. _________________________________ test_cancel __________________________________
  1224.  
  1225. def test_cancel ():
  1226. > unsigned_tx_hex = cancel.create(db, 'ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2')
  1227.  
  1228. dist/counterpartyd/test/test_.py:280:
  1229. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1230.  
  1231. db = <apsw.Connection object at 0x7fbb4c256258>
  1232. offer_hash = 'ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2'
  1233. unsigned = False
  1234.  
  1235. def create (db, offer_hash, unsigned=False):
  1236. source, offer, problems = validate(db, offer_hash)
  1237. > if problems: raise exceptions.CancelError(problems)
  1238. E lib.exceptions.CancelError: ['no valid offer with that hash']
  1239.  
  1240. dist/counterpartyd/lib/cancel.py:38: CancelError
  1241. ________________________________ test_overburn _________________________________
  1242.  
  1243. def test_overburn ():
  1244. unsigned_tx_hex = burn.create(db, source_default, (1 * config.UNIT), overburn=True) # Try to burn a whole 'nother BTC.
  1245.  
  1246. > parse_hex(unsigned_tx_hex)
  1247.  
  1248. dist/counterpartyd/test/test_.py:289:
  1249. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1250.  
  1251. unsigned_tx_hex = '0100000001c1d8c075936c3495f6d653c50f73d987f75448d97a750249b1eb83bee71b24ae0000000000ffffffff0200e1f505000000001976a914a11b66a67b3ff69671c8f82254099faf374b800e88ac0457f405000000001976a9144838d8b3588c4c7ba7c1d06f866e9b3739c6303788ac00000000'
  1252.  
  1253. def parse_hex (unsigned_tx_hex):
  1254.  
  1255. tx = bitcoin.rpc('decoderawtransaction', [unsigned_tx_hex])
  1256. source, destination, btc_amount, fee, data = blocks.get_tx_info(tx)
  1257.  
  1258. parse_hex_cursor = db.cursor()
  1259. tx_hash = hashlib.sha256(chr(tx_index).encode('utf-8')).hexdigest()
  1260. global tx_index
  1261. parse_hex_cursor.execute('''INSERT INTO transactions(
  1262. tx_index,
  1263. tx_hash,
  1264. block_index,
  1265. block_time,
  1266. source,
  1267. destination,
  1268. btc_amount,
  1269. fee,
  1270. data) VALUES(?,?,?,?,?,?,?,?,?)''',
  1271. (tx_index,
  1272. tx_hash,
  1273. tx_index,
  1274. tx_index,
  1275. source,
  1276. destination,
  1277. btc_amount,
  1278. fee,
  1279. > data)
  1280. )
  1281.  
  1282. dist/counterpartyd/test/test_.py:77:
  1283. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1284.  
  1285. > ???
  1286. E apsw.ConstraintError: ConstraintError: PRIMARY KEY must be unique
  1287.  
  1288. src/cursor.c:231: ConstraintError
  1289. ______________________________ test_send_callable ______________________________
  1290.  
  1291. def test_send_callable ():
  1292. > unsigned_tx_hex = send.create(db, source_default, destination_default, 10000, 'BBBCD')
  1293.  
  1294. dist/counterpartyd/test/test_.py:294:
  1295. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1296.  
  1297. db = <apsw.Connection object at 0x7fbb4c256258>
  1298. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'
  1299. destination = 'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7', amount = 10000
  1300. asset = 'BBBCD', unsigned = False
  1301.  
  1302. def create (db, source, destination, amount, asset, unsigned=False):
  1303. balances = util.get_balances(db, address=source, asset=asset)
  1304. if not balances or balances[0]['amount'] < amount:
  1305. > raise exceptions.SendError('insufficient funds')
  1306. E lib.exceptions.SendError: insufficient funds
  1307.  
  1308. dist/counterpartyd/lib/send.py:26: SendError
  1309. ________________________________ test_callback _________________________________
  1310.  
  1311. def test_callback ():
  1312. > unsigned_tx_hex = callback.create(db, source_default, .3, 'BBBCD')
  1313.  
  1314. dist/counterpartyd/test/test_.py:301:
  1315. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1316.  
  1317. db = <apsw.Connection object at 0x7fbb4c256258>
  1318. source = 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', fraction_per_share = 0.3
  1319. asset = 'BBBCD', unsigned = False
  1320.  
  1321. def create (db, source, fraction_per_share, asset, unsigned=False):
  1322. call_price, callback_total, outputs, problems = validate(db, source, fraction_per_share, asset, None)
  1323. > if problems: raise exceptions.CallbackError(problems)
  1324. E lib.exceptions.CallbackError: ['no such asset, BBBCD.']
  1325.  
  1326. dist/counterpartyd/lib/callback.py:73: CallbackError
  1327. ___________________________________ test_db ____________________________________
  1328.  
  1329. def test_db():
  1330. GOOD = CURR_DIR + '/db.dump'
  1331. NEW = CURR_DIR + '/db.new.dump'
  1332.  
  1333. with open(GOOD, 'r') as f:
  1334. good_data = f.readlines()
  1335.  
  1336. import io
  1337. output=io.StringIO()
  1338. shell=apsw.Shell(stdout=output, args=(config.DATABASE,))
  1339. shell.process_command(".dump")
  1340. with open(NEW, 'w') as f:
  1341. lines = output.getvalue().split('\n')[8:]
  1342. new_data = '\n'.join(lines)
  1343. f.writelines(new_data)
  1344.  
  1345. import subprocess
  1346. > assert not subprocess.call(['diff', GOOD, NEW])
  1347. E assert not 1
  1348. 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'])
  1349. E + where <function call at 0x7fbb4da2cc20> = <module 'subprocess' from '/usr/lib/python3.3/subprocess.py'>.call
  1350.  
  1351. dist/counterpartyd/test/test_.py:361: AssertionError
  1352. ------------------------------- Captured stdout --------------------------------
  1353. 15,19d14
  1354. < INSERT INTO balances VALUES('mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',145431612500);
  1355. < INSERT INTO balances VALUES('n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','XCP',4550000000);
  1356. < INSERT INTO balances VALUES('mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',1000000000);
  1357. < INSERT INTO balances VALUES('mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',93000);
  1358. < INSERT INTO balances VALUES('n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','BBBCD',7000);
  1359. 21,24c16,17
  1360. < CREATE INDEX address_idx ON balances (address)
  1361. < ;
  1362. < CREATE INDEX asset_idx ON balances (asset)
  1363. < ;
  1364. ---
  1365. > CREATE INDEX address_idx ON balances (address);
  1366. > CREATE INDEX asset_idx ON balances (asset);
  1367. 65,67d57
  1368. < 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');
  1369. < 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)');
  1370. < 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');
  1371. 89,94d78
  1372. < INSERT INTO bets VALUES(10,'01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b',10,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,1388000100,50000000,8500000,25000000,4250000,0.0,15120,10,20,5000000,'Valid');
  1373. < INSERT INTO bets VALUES(11,'e7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6',11,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1,1388000100,25000000,4250000,41500000,0,0.0,15120,10,21,5000000,'Valid');
  1374. < INSERT INTO bets VALUES(12,'ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c977',12,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,1388000100,150000000,0,350000000,0,0.0,5040,10,22,5000000,'Valid');
  1375. < INSERT INTO bets VALUES(13,'9d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4',13,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1,1388000100,350000000,0,150000000,0,0.0,5040,10,23,5000000,'Valid');
  1376. < INSERT INTO bets VALUES(14,'4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47',14,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',2,1388000200,750000000,0,650000000,0,1.0,5040,10,24,5000000,'Valid');
  1377. < INSERT INTO bets VALUES(15,'dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8',15,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',3,1388000200,650000000,0,750000000,0,1.0,5040,10,25,5000000,'Valid');
  1378. 103,104c87
  1379. < CREATE INDEX blocks_block_index_idx ON blocks (block_index)
  1380. < ;
  1381. ---
  1382. > CREATE INDEX blocks_block_index_idx ON blocks (block_index);
  1383. 118,121d100
  1384. < INSERT INTO broadcasts VALUES(9,'2b4c342f5433ebe591a1da77e013d1b72475562d48578dca8b84bac6651c3cb9',9,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1388000000,100.0,5000000,'Unit Test','Valid');
  1385. < INSERT INTO broadcasts VALUES(16,'c555eab45d08845ae9f10d452a99bfcb06f74a50b988fe7e48dd323789b88ee3',16,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1388000050,99.86166,5000000,'Unit Test','Valid');
  1386. < INSERT INTO broadcasts VALUES(17,'4a64a107f0cb32536e5bce6c98c393db21cca7f4ea187ba8c4dca8b51d4ea80a',17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1388000101,100.343,5000000,'Unit Test','Valid');
  1387. < INSERT INTO broadcasts VALUES(18,'f299791cddd3d6664f6670842812ef6053eb6501bd6282a476bbbf3ee91e750c',18,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',1388000201,2.0,5000000,'Unit Test','Valid');
  1388. 123,124c102
  1389. < CREATE INDEX broadcasts_block_index_idx ON broadcasts (block_index)
  1390. < ;
  1391. ---
  1392. > CREATE INDEX broadcasts_block_index_idx ON broadcasts (block_index);
  1393. 135d112
  1394. < INSERT INTO btcpays VALUES(4,'e52d9c508c502347344d8c07ad91cbd6068afc75ff6292f062a09ca381c89e71',4,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5','Paid');
  1395. 137,138c114
  1396. < CREATE INDEX btcpays_block_index_idx ON btcpays (block_index)
  1397. < ;
  1398. ---
  1399. > CREATE INDEX btcpays_block_index_idx ON btcpays (block_index);
  1400. 150,151d125
  1401. < INSERT INTO burns VALUES(0,'6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d',0,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',62000000,93000000000,'Valid');
  1402. < INSERT INTO burns VALUES(21,'2f0fd1e89b8de1d57292742ec380ea47066e307ad645f5bc3adad8a06ff58608',21,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',38000000,57000000000,'Valid');
  1403. 153,154c127
  1404. < CREATE INDEX validity_idx ON burns (validity)
  1405. < ;
  1406. ---
  1407. > CREATE INDEX validity_idx ON burns (validity);
  1408. 166d138
  1409. < INSERT INTO callbacks VALUES(23,'8f11b05da785e43e713d03774c6bd3405d99cd3024af334ffd68db663aa37034',23,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','0.3','BBBCD','Valid');
  1410. 177d148
  1411. < INSERT INTO cancels VALUES(20,'83891d7fe85c33e52c8b4e5814c92fb6a3b9467299200538a6babaa8b452d879',20,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2','Valid');
  1412. 179,180c150
  1413. < CREATE INDEX cancels_block_index_idx ON cancels (block_index)
  1414. < ;
  1415. ---
  1416. > CREATE INDEX cancels_block_index_idx ON cancels (block_index);
  1417. 189,207d158
  1418. < INSERT INTO credits VALUES(0,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',93000000000);
  1419. < INSERT INTO credits VALUES(1,'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','XCP',50000000);
  1420. < INSERT INTO credits VALUES(4,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',100000000);
  1421. < INSERT INTO credits VALUES(5,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',1000000000);
  1422. < INSERT INTO credits VALUES(6,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',100000);
  1423. < INSERT INTO credits VALUES(7,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',60);
  1424. < INSERT INTO credits VALUES(8,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',800000);
  1425. < INSERT INTO credits VALUES(16,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',62250000);
  1426. < INSERT INTO credits VALUES(16,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',3112500);
  1427. < INSERT INTO credits VALUES(17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',184300000);
  1428. < INSERT INTO credits VALUES(17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',315700000);
  1429. < INSERT INTO credits VALUES(17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',25000000);
  1430. < INSERT INTO credits VALUES(18,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',1400000000);
  1431. < INSERT INTO credits VALUES(18,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',70000000);
  1432. < INSERT INTO credits VALUES(20,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',50000000);
  1433. < INSERT INTO credits VALUES(21,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',57000000000);
  1434. < INSERT INTO credits VALUES(22,'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','BBBCD',10000);
  1435. < INSERT INTO credits VALUES(23,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',3000);
  1436. < INSERT INTO credits VALUES(23,'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','XCP',4500000000);
  1437. 209,210c160
  1438. < CREATE INDEX credits_address_idx ON credits (address)
  1439. < ;
  1440. ---
  1441. > CREATE INDEX credits_address_idx ON credits (address);
  1442. 219,238d168
  1443. < INSERT INTO debits VALUES(1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',50000000);
  1444. < INSERT INTO debits VALUES(3,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',105000000);
  1445. < INSERT INTO debits VALUES(7,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',60);
  1446. < INSERT INTO debits VALUES(8,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',800000);
  1447. < INSERT INTO debits VALUES(10,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',50000000);
  1448. < INSERT INTO debits VALUES(10,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',2500000);
  1449. < INSERT INTO debits VALUES(11,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',25000000);
  1450. < INSERT INTO debits VALUES(11,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',1250000);
  1451. < INSERT INTO debits VALUES(12,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',150000000);
  1452. < INSERT INTO debits VALUES(12,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',7500000);
  1453. < INSERT INTO debits VALUES(13,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',350000000);
  1454. < INSERT INTO debits VALUES(13,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',17500000);
  1455. < INSERT INTO debits VALUES(14,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',750000000);
  1456. < INSERT INTO debits VALUES(14,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',37500000);
  1457. < INSERT INTO debits VALUES(15,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',650000000);
  1458. < INSERT INTO debits VALUES(15,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',32500000);
  1459. < INSERT INTO debits VALUES(19,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',50000000);
  1460. < INSERT INTO debits VALUES(22,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',10000);
  1461. < INSERT INTO debits VALUES(23,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',4500000000);
  1462. < INSERT INTO debits VALUES(23,'n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','BBBCD',3000);
  1463. 240,241c170
  1464. < CREATE INDEX debits_address_idx ON debits (address)
  1465. < ;
  1466. ---
  1467. > CREATE INDEX debits_address_idx ON debits (address);
  1468. 253,254d181
  1469. < INSERT INTO dividends VALUES(7,'ca358758f6d27e6cf45272937977a748fd88391db679ceda7dc7bf1f005ee879',7,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',6,'Valid');
  1470. < INSERT INTO dividends VALUES(8,'beead77994cf573341ec17b58bbf7eb34d2711c993c1d976b128b3188dc1829a',8,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBCD',8,'Valid');
  1471. 256,257c183
  1472. < CREATE INDEX dividends_block_index_idx ON dividends (block_index)
  1473. < ;
  1474. ---
  1475. > CREATE INDEX dividends_block_index_idx ON dividends (block_index);
  1476. 277,278d202
  1477. < INSERT INTO issuances VALUES(5,'e77b9a9ae9e30b0dbdb6f510a264ef9de781501d7b6b92ae89eb059c5ab743db',5,'BBBBE',1000000000,1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,0,0,0.0,'',0,'Valid');
  1478. < INSERT INTO issuances VALUES(6,'67586e98fad27da0b9968bc039a1ef34c939b9b8e523a8bef89d478608c5ecf6',6,'BBBCD',100000,0,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',0,1,1288855692,0.015,'foobar',0,'Valid');
  1479. 280,281c204
  1480. < CREATE INDEX issuances_idx ON issuances (block_index)
  1481. < ;
  1482. ---
  1483. > CREATE INDEX issuances_idx ON issuances (block_index);
  1484. 316d238
  1485. < INSERT INTO order_matches VALUES('dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5',2,'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',3,'084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BTC',50000000,'XCP',100000000,2,3,10,10,12,'Valid');
  1486. 318,319c240
  1487. < CREATE INDEX match_expire_index_idx ON order_matches (match_expire_index)
  1488. < ;
  1489. ---
  1490. > CREATE INDEX match_expire_index_idx ON order_matches (match_expire_index);
  1491. 339,341d259
  1492. < INSERT INTO orders VALUES(2,'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986',2,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BTC',50000000,0,'XCP',100000000,0,10,12,0,1000000,'Valid');
  1493. < INSERT INTO orders VALUES(3,'084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5',3,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','XCP',105000000,5000000,'BTC',50000000,0,10,13,900000,10000,'Valid');
  1494. < INSERT INTO orders VALUES(19,'ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2',19,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','BBBBE',50000000,50000000,'XCP',50000000,50000000,10,29,0,10000,'Invalid: cancelled');
  1495. 343,346c261,262
  1496. < CREATE INDEX block_index_idx ON orders (block_index)
  1497. < ;
  1498. < CREATE INDEX expire_index_idx ON orders (expire_index)
  1499. < ;
  1500. ---
  1501. > CREATE INDEX block_index_idx ON orders (block_index);
  1502. > CREATE INDEX expire_index_idx ON orders (expire_index);
  1503. 359,360d274
  1504. < INSERT INTO sends VALUES(1,'4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a',1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','XCP',50000000,'Valid');
  1505. < INSERT INTO sends VALUES(22,'7cb7c4547cf2653590d7a9ace60cc623d25148adfbc88a89aeb0ef88da7839ba',22,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7','BBBCD',10000,'Valid');
  1506. 362,363c276
  1507. < CREATE INDEX sends_block_index_idx ON sends (block_index)
  1508. < ;
  1509. ---
  1510. > CREATE INDEX sends_block_index_idx ON sends (block_index);
  1511. 378,401c291
  1512. < INSERT INTO transactions VALUES(0,'6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d',0,0,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mvCounterpartyXXXXXXXXXXXXXXW24Hef',62000000,10000,X'',1);
  1513. < INSERT INTO transactions VALUES(1,'4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a',1,1,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7',10860,10000,X'0000000000000000000000010000000002FAF080',1);
  1514. < INSERT INTO transactions VALUES(2,'dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986',2,2,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,1000000,X'0000000A00000000000000000000000002FAF08000000000000000010000000005F5E100000A0000000000000000',1);
  1515. < INSERT INTO transactions VALUES(3,'084fed08b978af4d7d196a7446a86b58009e636b611db16211b65a9aadff29c5',3,3,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000000A00000000000000010000000006422C4000000000000000000000000002FAF080000A00000000000DBBA0',1);
  1516. < INSERT INTO transactions VALUES(4,'e52d9c508c502347344d8c07ad91cbd6068afc75ff6292f062a09ca381c89e71',4,4,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',50000000,10000,X'0000000BDBC1B4C900FFE48D575B5DA5C638040125F65DB0FE3E24494B76EA986457D986084FED08B978AF4D7D196A7446A86B58009E636B611DB16211B65A9AADFF29C5',1);
  1517. < INSERT INTO transactions VALUES(5,'e77b9a9ae9e30b0dbdb6f510a264ef9de781501d7b6b92ae89eb059c5ab743db',5,5,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'000000140000000000004767000000003B9ACA0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
  1518. < INSERT INTO transactions VALUES(6,'67586e98fad27da0b9968bc039a1ef34c939b9b8e523a8bef89d478608c5ecf6',6,6,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'00000014000000000000476800000000000186A000014CD2608C3C75C28F06666F6F6261720000000000000000000000000000000000000000000000000000000000000000000000',1);
  1519. < INSERT INTO transactions VALUES(7,'ca358758f6d27e6cf45272937977a748fd88391db679ceda7dc7bf1f005ee879',7,7,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000003200000000000000060000000000004767',1);
  1520. < INSERT INTO transactions VALUES(8,'beead77994cf573341ec17b58bbf7eb34d2711c993c1d976b128b3188dc1829a',8,8,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000003200000000000000080000000000004768',1);
  1521. < INSERT INTO transactions VALUES(9,'2b4c342f5433ebe591a1da77e013d1b72475562d48578dca8b84bac6651c3cb9',9,9,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000001E52BB33004059000000000000004C4B4009556E69742054657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
  1522. < INSERT INTO transactions VALUES(10,'01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b',10,10,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000052BB33640000000002FAF08000000000017D7840000000000000000000003B100000000A',1);
  1523. < INSERT INTO transactions VALUES(11,'e7cf46a078fed4fafd0b5e3aff144802b853f8ae459a4f0c14add3314b7cc3a6',11,11,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000152BB336400000000017D78400000000002793D60000000000000000000003B100000000A',1);
  1524. < INSERT INTO transactions VALUES(12,'ef6cbd2161eaea7943ce8693b9824d23d1793ffb1c0fca05b600d3899b44c977',12,12,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000052BB33640000000008F0D1800000000014DC93800000000000000000000013B00000000A',1);
  1525. < INSERT INTO transactions VALUES(13,'9d1e0e2d9459d06523ad13e28a4093c2316baafe7aec5b25f30eba2e113599c4',13,13,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000152BB33640000000014DC93800000000008F0D1800000000000000000000013B00000000A',1);
  1526. < INSERT INTO transactions VALUES(14,'4d7b3ef7300acf70c892d8327db8272f54434adbc61a4e130a563cb59a0d0f47',14,14,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000252BB33C8000000002CB417800000000026BE36803FF0000000000000000013B00000000A',1);
  1527. < INSERT INTO transactions VALUES(15,'dc0e9c3658a1a3ed1ec94274d8b19925c93e1abb7ddba294923ad9bde30f8cb8',15,15,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',10860,10000,X'00000028000352BB33C80000000026BE3680000000002CB417803FF0000000000000000013B00000000A',1);
  1528. < INSERT INTO transactions VALUES(16,'c555eab45d08845ae9f10d452a99bfcb06f74a50b988fe7e48dd323789b88ee3',16,16,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000001E52BB33324058F7256FFC115E004C4B4009556E69742054657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
  1529. < INSERT INTO transactions VALUES(17,'4a64a107f0cb32536e5bce6c98c393db21cca7f4ea187ba8c4dca8b51d4ea80a',17,17,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000001E52BB3365405915F3B645A1CB004C4B4009556E69742054657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
  1530. < INSERT INTO transactions VALUES(18,'f299791cddd3d6664f6670842812ef6053eb6501bd6282a476bbbf3ee91e750c',18,18,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000001E52BB33C94000000000000000004C4B4009556E69742054657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000',1);
  1531. < INSERT INTO transactions VALUES(19,'ab897fbdedfa502b2d839b6a56100887dccdc507555c282e59589e06300a62e2',19,19,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'0000000A00000000000047670000000002FAF08000000000000000010000000002FAF080000A0000000000000000',1);
  1532. < INSERT INTO transactions VALUES(20,'83891d7fe85c33e52c8b4e5814c92fb6a3b9467299200538a6babaa8b452d879',20,20,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'00000046AB897FBDEDFA502B2D839B6A56100887DCCDC507555C282E59589E06300A62E2',1);
  1533. < INSERT INTO transactions VALUES(21,'2f0fd1e89b8de1d57292742ec380ea47066e307ad645f5bc3adad8a06ff58608',21,21,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','mvCounterpartyXXXXXXXXXXXXXXW24Hef',100000000,10000,X'',1);
  1534. < INSERT INTO transactions VALUES(22,'7cb7c4547cf2653590d7a9ace60cc623d25148adfbc88a89aeb0ef88da7839ba',22,22,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc','n3BrDB6zDiEPWEE6wLxywFb4Yp9ZY5fHM7',10860,10000,X'0000000000000000000047680000000000002710',1);
  1535. < INSERT INTO transactions VALUES(23,'8f11b05da785e43e713d03774c6bd3405d99cd3024af334ffd68db663aa37034',23,23,'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc',NULL,NULL,10000,X'000000153FD33333333333330000000000004768',1);
  1536. ---
  1537. > INSERT INTO transactions VALUES(0,'6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d',0,0,X'',NULL,NULL,NULL,NULL,1);
  1538. 403,408c293,295
  1539. < CREATE INDEX transactions_block_index_idx ON transactions (block_index)
  1540. < ;
  1541. < CREATE INDEX transactions_tx_hash_idx ON transactions (tx_hash)
  1542. < ;
  1543. < CREATE INDEX transactions_tx_index_idx ON transactions (tx_index)
  1544. < ;
  1545. ---
  1546. > CREATE INDEX transactions_block_index_idx ON transactions (block_index);
  1547. > CREATE INDEX transactions_tx_hash_idx ON transactions (tx_hash);
  1548. > CREATE INDEX transactions_tx_index_idx ON transactions (tx_index);
  1549. _________________________________ test_output __________________________________
  1550.  
  1551. def test_output():
  1552. with open(CURR_DIR + '/output.new.json', 'w') as output_new_file:
  1553. json.dump(output_new, output_new_file, sort_keys=True, indent=4)
  1554.  
  1555. for key in output_new.keys():
  1556. try:
  1557. assert output[key] == output_new[key]
  1558. except Exception as e:
  1559. print('Key:', key)
  1560. print('Old output:')
  1561. print(output[key])
  1562. print('New output:')
  1563. print(output_new[key])
  1564. > raise e
  1565.  
  1566. dist/counterpartyd/test/test_.py:376:
  1567. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  1568.  
  1569. def test_output():
  1570. with open(CURR_DIR + '/output.new.json', 'w') as output_new_file:
  1571. json.dump(output_new, output_new_file, sort_keys=True, indent=4)
  1572.  
  1573. for key in output_new.keys():
  1574. try:
  1575. > assert output[key] == output_new[key]
  1576. E assert [{'address': ...et': 'BBBCD'}] == []
  1577. E Left contains more items, first extra item: {'address': 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc', 'amount': 145431612500, 'asset': 'XCP'}
  1578.  
  1579. dist/counterpartyd/test/test_.py:369: AssertionError
  1580. ------------------------------- Captured stdout --------------------------------
  1581. Key: rpc.get_balances
  1582. Old output:
  1583. [{'asset': 'XCP', 'amount': 145431612500, 'address': 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'}, {'asset': 'BBBBE', 'amount': 1000000000, 'address': 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'}, {'asset': 'BBBCD', 'amount': 93000, 'address': 'mn6q3dS2EnDUx3bmyWc6D4szJNVGtaR7zc'}]
  1584. New output:
  1585. []
  1586. ___________________________________ test_log ___________________________________
  1587.  
  1588. def test_log():
  1589. with open(CURR_DIR + '/log', 'r') as f:
  1590. old_log = f.readlines()
  1591. with open(CURR_DIR + '/log.new', 'r') as f:
  1592. new_log = f.readlines()
  1593.  
  1594. log_diff = list(difflib.unified_diff(old_log, new_log, n=0))
  1595. print(log_diff)
  1596. > assert not len(log_diff)
  1597. E assert not 73
  1598. 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', ...])
  1599.  
  1600. dist/counterpartyd/test/test_.py:386: AssertionError
  1601. ------------------------------- Captured stdout --------------------------------
  1602. ['--- \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']
  1603. ===================== 27 failed, 6 passed in 1.78 seconds ======================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement