Skip to content

Commit

Permalink
migrate database.py test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouziel committed Jan 25, 2025
1 parent 694b18a commit 4b85c39
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from counterpartycore.lib import config

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.backend.bitcoind:[437:454] ==counterpartycore.lib.backend.electrs:[83:100] if len(asm) == 4: # p2pkh # catch unhexlify errs for when asm[1] isn't a pubkey (eg; for P2SH) try: pubkey = asm[3] if ( pubkeyhash == PublicKey.from_hex(pubkey).get_address(compressed=False).to_string() ): return pubkey if ( pubkeyhash == PublicKey.from_hex(pubkey).get_address(compressed=True).to_string() ): return pubkey except binascii.Error: pass for vout in tx["vout"]:. Warning

Similar lines in 2 files
==counterpartycore.lib.backend.bitcoind:[437:454]
==counterpartycore.lib.backend.electrs:[83:100]
if len(asm) == 4: # p2pkh
# catch unhexlify errs for when asm[1] isn't a pubkey (eg; for P2SH)
try:
pubkey = asm[3]
if (
pubkeyhash
== PublicKey.from_hex(pubkey).get_address(compressed=False).to_string()
):
return pubkey
if (
pubkeyhash
== PublicKey.from_hex(pubkey).get_address(compressed=True).to_string()
):
return pubkey
except binascii.Error:
pass
for vout in tx["vout"]:.

Check warning

Code scanning / pylint

Similar lines in 2 files ==dividend_test:[133:145] ==send_test:[330:342] "source": defaults["addresses"][0], "status": "valid", "tx_hash": tx["tx_hash"], "tx_index": tx["tx_index"], }, }, { "table": "credits", "values": { "address": defaults["addresses"][1], "asset": "XCP", "block_index": current_block_index,. Warning

Similar lines in 2 files
==dividend_test:[133:145]
==send_test:[330:342]
"source": defaults["addresses"][0],
"status": "valid",
"tx_hash": tx["tx_hash"],
"tx_index": tx["tx_index"],
},
},
{
"table": "credits",
"values": {
"address": defaults["addresses"][1],
"asset": "XCP",
"block_index": current_block_index,.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.backend.bitcoind:[458:470] ==counterpartycore.lib.backend.electrs:[87:99] if ( pubkeyhash == PublicKey.from_hex(pubkey).get_address(compressed=False).to_string() ): return pubkey if ( pubkeyhash == PublicKey.from_hex(pubkey).get_address(compressed=True).to_string() ): return pubkey except binascii.Error: pass. Warning

Similar lines in 2 files
==counterpartycore.lib.backend.bitcoind:[458:470]
==counterpartycore.lib.backend.electrs:[87:99]
if (
pubkeyhash
== PublicKey.from_hex(pubkey).get_address(compressed=False).to_string()
):
return pubkey
if (
pubkeyhash
== PublicKey.from_hex(pubkey).get_address(compressed=True).to_string()
):
return pubkey
except binascii.Error:
pass.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.backend.bitcoind:[441:453] ==counterpartycore.lib.backend.electrs:[104:116] if ( pubkeyhash == PublicKey.from_hex(pubkey).get_address(compressed=False).to_string() ): return pubkey if ( pubkeyhash == PublicKey.from_hex(pubkey).get_address(compressed=True).to_string() ): return pubkey except binascii.Error: pass. Warning

Similar lines in 2 files
==counterpartycore.lib.backend.bitcoind:[441:453]
==counterpartycore.lib.backend.electrs:[104:116]
if (
pubkeyhash
== PublicKey.from_hex(pubkey).get_address(compressed=False).to_string()
):
return pubkey
if (
pubkeyhash
== PublicKey.from_hex(pubkey).get_address(compressed=True).to_string()
):
return pubkey
except binascii.Error:
pass.

Check warning

Code scanning / pylint

Similar lines in 2 files ==burn_test:[176:187] ==send_test:[428:439] "status": "valid", "tx_hash": tx["tx_hash"], "tx_index": tx["tx_index"], }, }, { "table": "credits", "values": { "address": defaults["p2ms_addresses"][0], "asset": "XCP", "block_index": current_block_index,. Warning

Similar lines in 2 files
==burn_test:[176:187]
==send_test:[428:439]
"status": "valid",
"tx_hash": tx["tx_hash"],
"tx_index": tx["tx_index"],
},
},
{
"table": "credits",
"values": {
"address": defaults["p2ms_addresses"][0],
"asset": "XCP",
"block_index": current_block_index,.

Check warning

Code scanning / pylint

Similar lines in 2 files ==burn_test:[137:148] ==dividend_test:[134:145] "status": "valid", "tx_hash": tx["tx_hash"], "tx_index": tx["tx_index"], }, }, { "table": "credits", "values": { "address": defaults["addresses"][1], "asset": "XCP", "block_index": current_block_index,. Warning

Similar lines in 2 files
==burn_test:[137:148]
==dividend_test:[134:145]
"status": "valid",
"tx_hash": tx["tx_hash"],
"tx_index": tx["tx_index"],
},
},
{
"table": "credits",
"values": {
"address": defaults["addresses"][1],
"asset": "XCP",
"block_index": current_block_index,.

Check warning

Code scanning / pylint

Similar lines in 2 files ==attach_test:[78:89] ==utxo_test:[85:96] "asset": "XCP", "quantity": 100, "event": tx["tx_hash"], "block_index": current_block_index, "tx_index": tx["tx_index"], "action": "attach to utxo", }, }, { "table": "credits", "values": {. Warning

Similar lines in 2 files
==attach_test:[78:89]
==utxo_test:[85:96]
"asset": "XCP",
"quantity": 100,
"event": tx["tx_hash"],
"block_index": current_block_index,
"tx_index": tx["tx_index"],
"action": "attach to utxo",
},
},
{
"table": "credits",
"values": {.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.messages.dispense:[182:194] ==counterpartycore.lib.messages.dispenser:[760:772] } ledger.markets.update_dispenser( db, dispenser["rowid"], set_data, { "source": dispenser["source"], "asset": dispenser["asset"], "tx_hash": dispenser["tx_hash"], }, ) # use tx_index=0 for block actions . Warning

Similar lines in 2 files
==counterpartycore.lib.messages.dispense:[182:194]
==counterpartycore.lib.messages.dispenser:[760:772]
}
ledger.markets.update_dispenser(
db,
dispenser["rowid"],
set_data,
{
"source": dispenser["source"],
"asset": dispenser["asset"],
"tx_hash": dispenser["tx_hash"],
},
) # use tx_index=0 for block actions
.

Check warning

Code scanning / pylint

Similar lines in 2 files ==0004.create_and_populate_assets_info:[24:37] ==0005.create_and_populate_events_count:[23:36] if hasattr(db, "row_factory"): db.row_factory = dict_factory attached = ( db.execute( "SELECT COUNT(*) AS count FROM pragma_database_list WHERE name = ?", ("ledger_db",) ).fetchone()["count"] > 0 ) if not attached: db.execute("ATTACH DATABASE ? AS ledger_db", (config.DATABASE,)) db.execute(""". Warning

Similar lines in 2 files
==0004.create_and_populate_assets_info:[24:37]
==0005.create_and_populate_events_count:[23:36]
if hasattr(db, "row_factory"):
db.row_factory = dict_factory attached = ( db.execute( "SELECT COUNT(\*) AS count FROM pragma\_database\_list WHERE name = ?", ("ledger\_db",) ).fetchone()["count"] > 0 ) if not attached: db.execute("ATTACH DATABASE ? AS ledger\_db", (config.DATABASE,)) db.execute(""".

Check warning

Code scanning / pylint

Similar lines in 2 files ==0002.create_and_populate_parsed_events:[23:45] ==0003.create_and_populate_all_expirations:[23:44] if hasattr(db, "row_factory"): db.row_factory = dict_factory attached = ( db.execute( "SELECT COUNT(*) AS count FROM pragma_database_list WHERE name = ?", ("ledger_db",) ).fetchone()["count"] > 0 ) if not attached: db.execute("ATTACH DATABASE ? AS ledger_db", (config.DATABASE,)) sqls = [ """ CREATE TABLE parsed_events( event_index INTEGER, event TEXT, event_hash TEXT, block_index INTEGER ); """, """. Warning

Similar lines in 2 files
==0002.create_and_populate_parsed_events:[23:45]
==0003.create_and_populate_all_expirations:[23:44]
if hasattr(db, "row_factory"):
db.row_factory = dict_factory attached = ( db.execute( "SELECT COUNT(\*) AS count FROM pragma\_database\_list WHERE name = ?", ("ledger\_db",) ).fetchone()["count"] > 0 ) if not attached: db.execute("ATTACH DATABASE ? AS ledger\_db", (config.DATABASE,)) sqls = [ """ CREATE TABLE parsed\_events( event\_index INTEGER, event TEXT, event\_hash TEXT, block\_index INTEGER ); """, """.

Check warning

Code scanning / pylint

Similar lines in 2 files ==send_test:[10:23] ==versions.mpma_test:[267:278] ledger.events.insert_record( ledger_db, "addresses", { "block_index": current_block_index, "address": defaults["addresses"][6], "options": config.ADDRESS_OPTION_REQUIRE_MEMO, }, "NEW_ADDRESS_OPTIONS", ) def test_validate(ledger_db, defaults, current_block_index):. Warning

Similar lines in 2 files
==send_test:[10:23]
==versions.mpma_test:[267:278]
ledger.events.insert_record(
ledger_db,
"addresses",
{
"block_index": current_block_index,
"address": defaults["addresses"][6],
"options": config.ADDRESS_OPTION_REQUIRE_MEMO,
},
"NEW_ADDRESS_OPTIONS",
) def test_validate(ledger_db, defaults, current_block_index):.

Check warning

Code scanning / pylint

Similar lines in 2 files ==dividend_test:[216:226] ==send_test:[569:579] "source": defaults["addresses"][0], "status": "valid", "tx_hash": tx["tx_hash"], "tx_index": tx["tx_index"], }, }, { "table": "credits", "values": { "address": defaults["addresses"][1],. Warning

Similar lines in 2 files
==dividend_test:[216:226]
==send_test:[569:579]
"source": defaults["addresses"][0],
"status": "valid",
"tx_hash": tx["tx_hash"],
"tx_index": tx["tx_index"],
},
},
{
"table": "credits",
"values": {
"address": defaults["addresses"][1],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==dividend_test:[133:143] ==send_test:[379:389] "source": defaults["addresses"][0], "status": "valid", "tx_hash": tx["tx_hash"], "tx_index": tx["tx_index"], }, }, { "table": "credits", "values": { "address": defaults["addresses"][1],. Warning

Similar lines in 2 files
==dividend_test:[133:143]
==send_test:[379:389]
"source": defaults["addresses"][0],
"status": "valid",
"tx_hash": tx["tx_hash"],
"tx_index": tx["tx_index"],
},
},
{
"table": "credits",
"values": {
"address": defaults["addresses"][1],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==detach_test:[51:61] ==utxo_test:[149:159] test_helpers.check_records( ledger_db, [ { "table": "sends", "values": { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"], "status": "valid",. Warning

Similar lines in 2 files
==detach_test:[51:61]
==utxo_test:[149:159]
test_helpers.check_records(
ledger_db,
[
{
"table": "sends",
"values": {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],
"status": "valid",.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.messages.attach:[15:31] ==counterpartycore.lib.messages.utxo:[17:33] problems = [] if asset == config.BTC: problems.append("cannot send bitcoins") # Only for parsing. if not isinstance(quantity, int): problems.append("quantity must be in satoshis") return problems if quantity <= 0: problems.append("quantity must be greater than zero") # For SQLite3 if quantity > config.MAX_INT: problems.append("integer overflow") . Warning

Similar lines in 2 files
==counterpartycore.lib.messages.attach:[15:31]
==counterpartycore.lib.messages.utxo:[17:33]
problems = [] if asset == config.BTC: problems.append("cannot send bitcoins") # Only for parsing. if not isinstance(quantity, int): problems.append("quantity must be in satoshis") return problems if quantity <= 0: problems.append("quantity must be greater than zero") # For SQLite3 if quantity > config.MAX_INT: problems.append("integer overflow") .

Check warning

Code scanning / pylint

Similar lines in 2 files ==0003.create_and_populate_all_expirations:[23:35] ==0004.create_and_populate_assets_info:[24:36] if hasattr(db, "row_factory"): db.row_factory = dict_factory attached = ( db.execute( "SELECT COUNT(*) AS count FROM pragma_database_list WHERE name = ?", ("ledger_db",) ).fetchone()["count"] > 0 ) if not attached: db.execute("ATTACH DATABASE ? AS ledger_db", (config.DATABASE,)) . Warning

Similar lines in 2 files
==0003.create_and_populate_all_expirations:[23:35]
==0004.create_and_populate_assets_info:[24:36]
if hasattr(db, "row_factory"):
db.row_factory = dict_factory attached = ( db.execute( "SELECT COUNT(\*) AS count FROM pragma\_database\_list WHERE name = ?", ("ledger\_db",) ).fetchone()["count"] > 0 ) if not attached: db.execute("ATTACH DATABASE ? AS ledger\_db", (config.DATABASE,)) .

Check warning

Code scanning / pylint

Similar lines in 2 files ==0001.create_and_populate_address_events:[22:34] ==0002.create_and_populate_parsed_events:[23:35] if hasattr(db, "row_factory"): db.row_factory = dict_factory attached = ( db.execute( "SELECT COUNT(*) AS count FROM pragma_database_list WHERE name = ?", ("ledger_db",) ).fetchone()["count"] > 0 ) if not attached: db.execute("ATTACH DATABASE ? AS ledger_db", (config.DATABASE,)) . Warning

Similar lines in 2 files
==0001.create_and_populate_address_events:[22:34]
==0002.create_and_populate_parsed_events:[23:35]
if hasattr(db, "row_factory"):
db.row_factory = dict_factory attached = ( db.execute( "SELECT COUNT(\*) AS count FROM pragma\_database\_list WHERE name = ?", ("ledger\_db",) ).fetchone()["count"] > 0 ) if not attached: db.execute("ATTACH DATABASE ? AS ledger\_db", (config.DATABASE,)) .

Check warning

Code scanning / pylint

Similar lines in 2 files ==blocks_test:[41:50] ==send_test:[417:426] test_helpers.check_records( ledger_db, [ { "table": "sends", "values": { "asset": "XCP", "block_index": tx["block_index"], "destination": defaults["p2ms_addresses"][0],. Warning

Similar lines in 2 files
==blocks_test:[41:50]
==send_test:[417:426]
test_helpers.check_records(
ledger_db,
[
{
"table": "sends",
"values": {
"asset": "XCP",
"block_index": tx["block_index"],
"destination": defaults["p2ms_addresses"][0],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==blocks_test:[12:21] ==send_test:[320:329] test_helpers.check_records( ledger_db, [ { "table": "sends", "values": { "asset": "XCP", "block_index": tx["block_index"], "destination": defaults["addresses"][1],. Warning

Similar lines in 2 files
==blocks_test:[12:21]
==send_test:[320:329]
test_helpers.check_records(
ledger_db,
[
{
"table": "sends",
"values": {
"asset": "XCP",
"block_index": tx["block_index"],
"destination": defaults["addresses"][1],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==move_test:[107:116] ==utxo_test:[104:113] }, }, { "table": "sends", "values": { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"], "status": "valid",. Warning

Similar lines in 2 files
==move_test:[107:116]
==utxo_test:[104:113]
},
},
{
"table": "sends",
"values": {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],
"status": "valid",.

Check warning

Code scanning / pylint

Similar lines in 2 files ==dividend_test:[133:142] ==send_test:[427:436] "source": defaults["addresses"][0], "status": "valid", "tx_hash": tx["tx_hash"], "tx_index": tx["tx_index"], }, }, { "table": "credits", "values": {. Warning

Similar lines in 2 files
==dividend_test:[133:142]
==send_test:[427:436]
"source": defaults["addresses"][0],
"status": "valid",
"tx_hash": tx["tx_hash"],
"tx_index": tx["tx_index"],
},
},
{
"table": "credits",
"values": {.

Check warning

Code scanning / pylint

Similar lines in 2 files ==dispense_test:[70:82] ==dispenser_test:[221:235] "address": defaults["addresses"][0], "asset": "XCP", "block_index": current_block_index, "event": tx["tx_hash"], "quantity": 100, }, }, ], ) def test_parse_lost_found(ledger_db, blockchain_mock, defaults, test_helpers, current_block_index):. Warning

Similar lines in 2 files
==dispense_test:[70:82]
==dispenser_test:[221:235]
"address": defaults["addresses"][0],
"asset": "XCP",
"block_index": current_block_index,
"event": tx["tx_hash"],
"quantity": 100,
},
},
],
) def test_parse_lost_found(ledger_db, blockchain_mock, defaults, test_helpers, current_block_index):.

Check warning

Code scanning / pylint

Similar lines in 2 files ==detach_test:[111:120] ==versions.mpma_test:[672:681] test_helpers.check_records( ledger_db, [ { "table": "sends", "values": { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"],. Warning

Similar lines in 2 files
==detach_test:[111:120]
==versions.mpma_test:[672:681]
test_helpers.check_records(
ledger_db,
[
{
"table": "sends",
"values": {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==detach_test:[81:90] ==versions.mpma_test:[591:600] test_helpers.check_records( ledger_db, [ { "table": "sends", "values": { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"],. Warning

Similar lines in 2 files
==detach_test:[81:90]
==versions.mpma_test:[591:600]
test_helpers.check_records(
ledger_db,
[
{
"table": "sends",
"values": {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==detach_test:[51:60] ==versions.mpma_test:[508:517] test_helpers.check_records( ledger_db, [ { "table": "sends", "values": { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"],. Warning

Similar lines in 2 files
==detach_test:[51:60]
==versions.mpma_test:[508:517]
test_helpers.check_records(
ledger_db,
[
{
"table": "sends",
"values": {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==detach_test:[84:93] ==move_test:[109:118] { "table": "sends", "values": { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"], "status": "valid", "source": utxo, "source_address": defaults["addresses"][0],. Warning

Similar lines in 2 files
==detach_test:[84:93]
==move_test:[109:118]
{
"table": "sends",
"values": {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],
"status": "valid",
"source": utxo,
"source_address": defaults["addresses"][0],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==detach_test:[54:63] ==move_test:[51:60] { "table": "sends", "values": { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"], "status": "valid", "source": utxo, "source_address": defaults["addresses"][0],. Warning

Similar lines in 2 files
==detach_test:[54:63]
==move_test:[51:60]
{
"table": "sends",
"values": {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],
"status": "valid",
"source": utxo,
"source_address": defaults["addresses"][0],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==burn_test:[137:146] ==send_test:[380:389] "status": "valid", "tx_hash": tx["tx_hash"], "tx_index": tx["tx_index"], }, }, { "table": "credits", "values": { "address": defaults["addresses"][1],. Warning

Similar lines in 2 files
==burn_test:[137:146]
==send_test:[380:389]
"status": "valid",
"tx_hash": tx["tx_hash"],
"tx_index": tx["tx_index"],
},
},
{
"table": "credits",
"values": {
"address": defaults["addresses"][1],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==attach_test:[109:118] ==utxo_test:[115:124] "asset": "XCP", "quantity": 100, "fee_paid": 0, "send_type": "attach", }, }, { "table": "messages", "values": {. Warning

Similar lines in 2 files
==attach_test:[109:118]
==utxo_test:[115:124]
"asset": "XCP",
"quantity": 100,
"fee_paid": 0,
"send_type": "attach",
},
},
{
"table": "messages",
"values": {.

Check warning

Code scanning / pylint

Similar lines in 2 files ==attach_test:[97:106] ==move_test:[49:58] }, }, { "table": "sends", "values": { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"], "status": "valid",. Warning

Similar lines in 2 files
==attach_test:[97:106]
==move_test:[49:58]
},
},
{
"table": "sends",
"values": {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],
"status": "valid",.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.messages.fairmint:[117:126] ==counterpartycore.lib.messages.fairminter:[359:368] if problems: status = "invalid: " + "; ".join(problems) bindings = { "tx_hash": tx["tx_hash"], "tx_index": tx["tx_index"], "block_index": tx["block_index"], "source": tx["source"], "status": status, }. Warning

Similar lines in 2 files
==counterpartycore.lib.messages.fairmint:[117:126]
==counterpartycore.lib.messages.fairminter:[359:368]
if problems:
status = "invalid: " + "; ".join(problems)
bindings = {
"tx_hash": tx["tx_hash"],
"tx_index": tx["tx_index"],
"block_index": tx["block_index"],
"source": tx["source"],
"status": status,
}.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.messages.detach:[113:122] ==counterpartycore.lib.messages.move:[55:65] balance["asset"], balance["quantity"], tx["tx_index"], action=action, event=tx["tx_hash"], ) bindings = { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"],. Warning

Similar lines in 2 files
==counterpartycore.lib.messages.detach:[113:122]
==counterpartycore.lib.messages.move:[55:65]
balance["asset"],
balance["quantity"],
tx["tx_index"],
action=action,
event=tx["tx_hash"],
)
bindings = {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.messages.detach:[101:110] ==counterpartycore.lib.messages.move:[42:52] source_address = ledger.events.debit( db, source, balance["asset"], balance["quantity"], tx["tx_index"], action=action, event=tx["tx_hash"], ) # credit asset to destination. Warning

Similar lines in 2 files
==counterpartycore.lib.messages.detach:[101:110]
==counterpartycore.lib.messages.move:[42:52]
source_address = ledger.events.debit(
db,
source,
balance["asset"],
balance["quantity"],
tx["tx_index"],
action=action,
event=tx["tx_hash"],
)
# credit asset to destination.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.messages.attach:[151:161] ==counterpartycore.lib.messages.utxo:[217:227] event=tx["tx_hash"], ) # destroy fee destroy_bindings = { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "block_index": tx["block_index"], "source": tx["source"], "asset": config.XCP, "quantity": fee,. Warning

Similar lines in 2 files
==counterpartycore.lib.messages.attach:[151:161]
==counterpartycore.lib.messages.utxo:[217:227]
event=tx["tx_hash"],
)
# destroy fee
destroy_bindings = {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],
"source": tx["source"],
"asset": config.XCP,
"quantity": fee,.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.messages.attach:[192:202] ==counterpartycore.lib.messages.detach:[65:75] status = "valid" if problems: status = "invalid: " + "; ".join(problems) # store the invalid transaction without potentially invalid parameters bindings = { "tx_index": tx["tx_index"], "tx_hash": tx["tx_hash"], "msg_index": ledger.other.get_send_msg_index(db, tx["tx_hash"]), "block_index": tx["block_index"], "status": status,. Warning

Similar lines in 2 files
==counterpartycore.lib.messages.attach:[192:202]
==counterpartycore.lib.messages.detach:[65:75]
status = "valid"
if problems:
status = "invalid: " + "; ".join(problems)
# store the invalid transaction without potentially invalid parameters
bindings = {
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"msg_index": ledger.other.get_send_msg_index(db, tx["tx_hash"]),
"block_index": tx["block_index"],
"status": status,.

Check warning

Code scanning / pylint

Similar lines in 2 files ==counterpartycore.lib.api.compose:[449:458] ==counterpartycore.lib.messages.fairminter:[40:49] "price": price, "quantity_by_price": quantity_by_price, "max_mint_per_tx": max_mint_per_tx, "hard_cap": hard_cap, "premint_quantity": premint_quantity, "start_block": start_block, "end_block": end_block, "soft_cap": soft_cap, "soft_cap_deadline_block": soft_cap_deadline_block,. Warning

Similar lines in 2 files
==counterpartycore.lib.api.compose:[449:458]
==counterpartycore.lib.messages.fairminter:[40:49]
"price": price,
"quantity_by_price": quantity_by_price,
"max_mint_per_tx": max_mint_per_tx,
"hard_cap": hard_cap,
"premint_quantity": premint_quantity,
"start_block": start_block,
"end_block": end_block,
"soft_cap": soft_cap,
"soft_cap_deadline_block": soft_cap_deadline_block,.

Check warning

Code scanning / pylint

Similar lines in 2 files ==blocks_test:[12:20] ==send_test:[417:425] test_helpers.check_records( ledger_db, [ { "table": "sends", "values": { "asset": "XCP", "block_index": tx["block_index"],. Warning

Similar lines in 2 files
==blocks_test:[12:20]
==send_test:[417:425]
test_helpers.check_records(
ledger_db,
[
{
"table": "sends",
"values": {
"asset": "XCP",
"block_index": tx["block_index"],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==blocks_test:[41:49] ==send_test:[320:328] test_helpers.check_records( ledger_db, [ { "table": "sends", "values": { "asset": "XCP", "block_index": tx["block_index"],. Warning

Similar lines in 2 files
==blocks_test:[41:49]
==send_test:[320:328]
test_helpers.check_records(
ledger_db,
[
{
"table": "sends",
"values": {
"asset": "XCP",
"block_index": tx["block_index"],.

Check warning

Code scanning / pylint

Similar lines in 2 files ==order_test:[545:553] ==versions.mpma_test:[716:724] }, }, { "table": "credits", "values": { "address": defaults["addresses"][1], "asset": "DIVISIBLE", "block_index": current_block_index,. Warning

Similar lines in 2 files
==order_test:[545:553]
==versions.mpma_test:[716:724]
},
},
{
"table": "credits",
"values": {
"address": defaults["addresses"][1],
"asset": "DIVISIBLE",
"block_index": current_block_index,.
from counterpartycore.lib.utils import database


def test_version(ledger_db, test_helpers):
assert database.version(ledger_db) == (0, 0)

database.update_version(ledger_db)
test_helpers.check_records(
ledger_db,
[
{
"table": "pragma",
"field": "user_version",
"value": (config.VERSION_MAJOR * 1000) + config.VERSION_MINOR,
}
],
)

assert database.version(ledger_db) == (config.VERSION_MAJOR, config.VERSION_MINOR)

0 comments on commit 4b85c39

Please sign in to comment.