Skip to content

Commit

Permalink
Tweak asset_events
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouziel committed Oct 10, 2024
1 parent d3d1592 commit 85e558d
Show file tree
Hide file tree
Showing 11 changed files with 8,187 additions and 8,170 deletions.
3,510 changes: 1,755 additions & 1,755 deletions apiary.apib

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions counterparty-core/counterpartycore/lib/api/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import multiprocessing
import os
import signal
import sys
Expand All @@ -16,6 +17,8 @@
from gunicorn.errors import AppImportError
from werkzeug.serving import make_server

multiprocessing.set_start_method("spawn", force=True)

logger = logging.getLogger(config.LOGGER_NAME)

BACKEND_HEIGHT = None
Expand Down Expand Up @@ -56,6 +59,7 @@ def refresh_backend_height(db, start=False):
global BACKEND_HEIGHT, BACKEND_HEIGHT_TIMER # noqa F811
if not start:
BACKEND_HEIGHT = get_backend_height()
# print(f"BACKEND_HEIGHT: {BACKEND_HEIGHT} ({os.getpid()})")
refresh_current_block(db)
backend.addrindexrs.clear_raw_transactions_cache()
if not is_server_ready():
Expand Down Expand Up @@ -122,7 +126,7 @@ class GunicornArbiter(Arbiter):
def __init__(self, app):
super().__init__(app)
self.workers_pid_file = tempfile.NamedTemporaryFile()
self.log = DummyLogger()
# self.log = DummyLogger()

def add_worker_to_pid_file(self, pid):
self.workers_pid_file.write(f"{pid}\n".encode())
Expand Down Expand Up @@ -202,7 +206,7 @@ def __init__(self, app, args=None):
"worker_class": "gthread",
"daemon": True,
"threads": 2,
# "loglevel": "debug",
"loglevel": "debug",
# "access-logfile": "-",
}
self.application = app
Expand Down
16 changes: 12 additions & 4 deletions counterparty-core/counterpartycore/lib/messages/issuance.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ def parse(db, tx, message, message_type_id):
if tx["destination"]:
issuer = tx["destination"]
transfer = True
asset_events.append("transfer")
# quantity = 0
else:
issuer = tx["source"]
Expand All @@ -1005,16 +1006,18 @@ def parse(db, tx, message, message_type_id):

description_locked = False
if status == "valid" and description:
last_description = _get_last_description(db, asset, description)
if description.lower() == "lock":
lock = True
description = _get_last_description(db, asset, description)
asset_events.append("lock_quantity")
description = last_description
elif description.lower() == "lock_description" and util.enabled(
"lockable_issuance_descriptions", tx["block_index"]
):
description_locked = True
description = _get_last_description(db, asset, description)
description = last_description
asset_events.append("lock_description")
elif description != last_description:
asset_events.append("change_description")

if status == "valid" and not reissuance:
# Add to table of assets.
Expand All @@ -1030,10 +1033,15 @@ def parse(db, tx, message, message_type_id):
if status == "valid" and reissuance:
# when reissuing, add the asset_longname to the issuances table for API lookups
asset_longname = reissued_asset_longname
asset_events.append("reissuance")
else:
asset_longname = subasset_longname

if lock:
asset_events.append("lock_quantity")

if reissuance and quantity > 0:
asset_events.append("reissuance")

# Add parsed transaction to message-type–specific table.
bindings = {
"tx_index": tx["tx_index"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"difficulty": null,
"ledger_hash": "cbc22749655ce8e7fb2eeb4d1737a04dec7bc096ce84b00bf83ca4c7040f448a",
"txlist_hash": "b5cae1a9f44982ed3dd38f90d95cba93efbe9fd1e55b0f367e45336f3e68f786",
"messages_hash": "82e79417c7ec1856ced190d3fe19150f1510992e5abfd326b92edd143260259d",
"messages_hash": "704f5a0685b1309b5ba2a9082d9706ae7b9fe4e7b735a008b3c450eeeb2a4460",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -21,7 +21,7 @@
"difficulty": null,
"ledger_hash": "7cb406b1ee19e1ecfc41009f312d918ac0574b92809d99dbfd99bac88992a4fe",
"txlist_hash": "0b912b59131e6aef7fb3313ef75bc138dc1f612d76e77cf583074564ddb6d35c",
"messages_hash": "9e09c7b47df3a09f541b40931ccce3b512ca113a6d4dd5e6d3505e29bfea8e31",
"messages_hash": "2a4a14311bfbe235c7a867c69eeadf9d336667ec2abd8ecd3e9468897b0064c9",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -33,7 +33,7 @@
"difficulty": null,
"ledger_hash": "562a0f298a796b936c21bf552e6945ed2263b62d4022f7a072dc6a4790173e8d",
"txlist_hash": "6b6c62d0facf03efea19bf2e8fa69ecd3c433d45a0ca6b3ed57ed0e5d69b1e2f",
"messages_hash": "a12df3e7bce37d8f4a9c4c0a2a3f367fb071142acff947cecc23173b4925fb53",
"messages_hash": "965d20b7bbd4c014879731b7ab95f5b38335d80f74c8dc8ccc49e9222144d2c4",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -45,7 +45,7 @@
"difficulty": null,
"ledger_hash": "9cac238e8006f150dbd1f09f1743cb50e1870775d67a256ae5c06e0b72fd0b6e",
"txlist_hash": "1977d48057c66abe87f0bdffbcf4d501bd4b9fe138c0bc381409bc44bd503084",
"messages_hash": "8a30a60098f9f82a118549ec730568a44d5fa6eb3335a20aec2b44599039342d",
"messages_hash": "ab881a7cc3381dbeb809e622050540b87c404a8a723334e4d6b46482d54f325c",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -57,7 +57,7 @@
"difficulty": null,
"ledger_hash": "d3ea9e3e4912d71dde006b1f1b2d412d213bee18c8c7606982a08f405c932a12",
"txlist_hash": "d91fc03fd15e2ca4fc59b7be29586b0c8f2942abca45ccb49f2fc84e3eff8f94",
"messages_hash": "3a2b15d7772dd7a9d22d7bfcc558ec8da5713b427e25289eb809b4edeb673e2e",
"messages_hash": "b84e80bcae7f2d7d19a8a6deee33b8836bd6bd62b53f9a8d38995bf458c39b06",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -69,7 +69,7 @@
"difficulty": null,
"ledger_hash": "7a3e7800ae592d461c8d4a90597d65257e14082534f0052e862ea6665151fa65",
"txlist_hash": "9b6c282c7fb96cbca27fe6b73253cfc31b93ff71dc0d116ebd0d661c33adde58",
"messages_hash": "2d3ce8e66aa0fa6491fa43efa2de7264011d91dc04b6a7aa37d7974876c3c22a",
"messages_hash": "124decc91575b2b3b4e5c82252f5bad4c3fbad53d82e2cb387ebdf516582ca73",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -81,7 +81,7 @@
"difficulty": null,
"ledger_hash": "ef8ebcfad12ea2bdff5760d7a28fd6e0c9ff1f80c5db666df99daf73bb758584",
"txlist_hash": "663e67da5996a4c9877a6c6cb61730798695aee9d89674823917dee2d1ab9708",
"messages_hash": "ef1273df0c8d6bbe9078468440fe92eec3515e5985064775d453615448d836cd",
"messages_hash": "1f8c4bf719ff7da97a2ae86354d1d9453f98f772b3302afaf87143d198d2c480",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -93,7 +93,7 @@
"difficulty": null,
"ledger_hash": "122e4a4d499019a24ee9fcb024541d3ad30e06cda616f82b21a5e18bcaf58728",
"txlist_hash": "deb12f7c45ab5944a6e08fb2933d3a435860f9e1d8a758486b5e5995258ca973",
"messages_hash": "1b9aef26cd6d6e43ebc95c01db0ce8ccb05b8400955737643bef4458471f7c29",
"messages_hash": "c65d6968b5674d0faa3ba0ced721c7bb0e452d06db2cd4cc0c87056b42cd81ce",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -105,7 +105,7 @@
"difficulty": null,
"ledger_hash": "e6a29a3329dac5849c6019688653cb9179792254ea263d908ee1840812eae1e1",
"txlist_hash": "9b08253a46b87ab3df60af60b519dd0c689c0acaca38bcc33f01000bf6b871d3",
"messages_hash": "7112da51430ab9dfb8dba1fe06f52fcffdac61e146a50c73e95e1ecffa62b6fd",
"messages_hash": "b0a954ecb6f6b298444e634e0e35c8dc8e642d4cc766e403d18e013081e38552",
"transaction_count": 0,
"confirmed": true
},
Expand All @@ -117,7 +117,7 @@
"difficulty": null,
"ledger_hash": "2571bbddd1991d25250bcd1789cd861bda55aeff5e70c90fd854bf7850b478e8",
"txlist_hash": "52939845593123714b4bd665600642d14b61a384befa3498c7582806448150a1",
"messages_hash": "193fa09a1d321e9e1eb9fadf56dbf46128a0e0f23276afb0af169be0a2714a51",
"messages_hash": "4fd7a64e2d1cfea79d942ac7b358740a3c066cd72c8ec30133cf420f51053212",
"transaction_count": 0,
"confirmed": true
}
Expand All @@ -134,7 +134,7 @@
"difficulty": null,
"ledger_hash": "cbc22749655ce8e7fb2eeb4d1737a04dec7bc096ce84b00bf83ca4c7040f448a",
"txlist_hash": "b5cae1a9f44982ed3dd38f90d95cba93efbe9fd1e55b0f367e45336f3e68f786",
"messages_hash": "82e79417c7ec1856ced190d3fe19150f1510992e5abfd326b92edd143260259d",
"messages_hash": "704f5a0685b1309b5ba2a9082d9706ae7b9fe4e7b735a008b3c450eeeb2a4460",
"transaction_count": 0,
"confirmed": true
}
Expand All @@ -148,7 +148,7 @@
"difficulty": null,
"ledger_hash": "3114d8091cfcaa9944c6fab49d51950535c4ef269877d58c372ed80b2b472ec6",
"txlist_hash": "f065728a3544adc085fae976759c0d040a34ca0a8ddd39260b55f0262cd5baa8",
"messages_hash": "9e9c8f8f8d7dfb437d16e3fb14b93104a64d31577e5771fd91ad73d816d0feae",
"messages_hash": "b36a13ee6d0e5c14dc24a84358530a52e6ea450824a194612b6eb65d9320188c",
"transaction_count": 1,
"confirmed": true
}
Expand All @@ -162,7 +162,7 @@
"difficulty": null,
"ledger_hash": "6c240f1f3a985ff91e6a280c4448b8d739a06caa6fa383c4b9a7b90d27bdb17b",
"txlist_hash": "d21ed1a33a3ff157708a8e8c5a11062e0b33a7682896f695cd174ee93dce7767",
"messages_hash": "7e9485dcce4f7f6aa33c498249ecf99ffb3cd102cc30888c70b93c73d43d591d",
"messages_hash": "3ffd1160eaebd802f207462d3c2fb3124fbc3beefed8fbe9b6473bd906140074",
"transaction_count": 1,
"confirmed": true
}
Expand Down Expand Up @@ -227,7 +227,7 @@
"params": {
"block_index": 310491,
"ledger_hash": "3114d8091cfcaa9944c6fab49d51950535c4ef269877d58c372ed80b2b472ec6",
"messages_hash": "9e9c8f8f8d7dfb437d16e3fb14b93104a64d31577e5771fd91ad73d816d0feae",
"messages_hash": "b36a13ee6d0e5c14dc24a84358530a52e6ea450824a194612b6eb65d9320188c",
"transaction_count": 1,
"txlist_hash": "f065728a3544adc085fae976759c0d040a34ca0a8ddd39260b55f0262cd5baa8",
"block_time": 310491000
Expand Down Expand Up @@ -3345,7 +3345,7 @@
"reset": false,
"description_locked": false,
"fair_minting": false,
"asset_events": "lock_quantity reissuance",
"asset_events": "lock_quantity",
"confirmed": true,
"block_time": 310005000,
"quantity_normalized": "0.00000000",
Expand Down Expand Up @@ -6068,7 +6068,7 @@
"params": {
"block_index": 310703,
"ledger_hash": "cbc22749655ce8e7fb2eeb4d1737a04dec7bc096ce84b00bf83ca4c7040f448a",
"messages_hash": "82e79417c7ec1856ced190d3fe19150f1510992e5abfd326b92edd143260259d",
"messages_hash": "704f5a0685b1309b5ba2a9082d9706ae7b9fe4e7b735a008b3c450eeeb2a4460",
"transaction_count": 0,
"txlist_hash": "b5cae1a9f44982ed3dd38f90d95cba93efbe9fd1e55b0f367e45336f3e68f786",
"block_time": 310703000
Expand Down Expand Up @@ -6099,7 +6099,7 @@
"params": {
"block_index": 310702,
"ledger_hash": "7cb406b1ee19e1ecfc41009f312d918ac0574b92809d99dbfd99bac88992a4fe",
"messages_hash": "9e09c7b47df3a09f541b40931ccce3b512ca113a6d4dd5e6d3505e29bfea8e31",
"messages_hash": "2a4a14311bfbe235c7a867c69eeadf9d336667ec2abd8ecd3e9468897b0064c9",
"transaction_count": 0,
"txlist_hash": "0b912b59131e6aef7fb3313ef75bc138dc1f612d76e77cf583074564ddb6d35c",
"block_time": 310702000
Expand Down Expand Up @@ -6130,7 +6130,7 @@
"params": {
"block_index": 310701,
"ledger_hash": "562a0f298a796b936c21bf552e6945ed2263b62d4022f7a072dc6a4790173e8d",
"messages_hash": "a12df3e7bce37d8f4a9c4c0a2a3f367fb071142acff947cecc23173b4925fb53",
"messages_hash": "965d20b7bbd4c014879731b7ab95f5b38335d80f74c8dc8ccc49e9222144d2c4",
"transaction_count": 0,
"txlist_hash": "6b6c62d0facf03efea19bf2e8fa69ecd3c433d45a0ca6b3ed57ed0e5d69b1e2f",
"block_time": 310701000
Expand Down Expand Up @@ -7015,7 +7015,7 @@
"reset": false,
"description_locked": false,
"fair_minting": false,
"asset_events": "reissuance",
"asset_events": "change_description",
"confirmed": true,
"block_time": 310115000,
"quantity_normalized": "0.00000000",
Expand Down Expand Up @@ -7043,7 +7043,7 @@
"reset": false,
"description_locked": false,
"fair_minting": false,
"asset_events": "lock_quantity reissuance",
"asset_events": "lock_quantity",
"confirmed": true,
"block_time": 310114000,
"quantity_normalized": "0.00000000",
Expand Down Expand Up @@ -7155,7 +7155,7 @@
"reset": false,
"description_locked": false,
"fair_minting": false,
"asset_events": "lock_quantity reissuance",
"asset_events": "lock_quantity",
"confirmed": true,
"block_time": 310005000,
"quantity_normalized": "0.00000000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
"block_index": 310703,
"command": "parse",
"category": "blocks",
"bindings": '{"block_index":310703,"ledger_hash":"cbc22749655ce8e7fb2eeb4d1737a04dec7bc096ce84b00bf83ca4c7040f448a","messages_hash":"82e79417c7ec1856ced190d3fe19150f1510992e5abfd326b92edd143260259d","transaction_count":0,"txlist_hash":"b5cae1a9f44982ed3dd38f90d95cba93efbe9fd1e55b0f367e45336f3e68f786"}',
"bindings": '{"block_index":310703,"ledger_hash":"cbc22749655ce8e7fb2eeb4d1737a04dec7bc096ce84b00bf83ca4c7040f448a","messages_hash":"704f5a0685b1309b5ba2a9082d9706ae7b9fe4e7b735a008b3c450eeeb2a4460","transaction_count":0,"txlist_hash":"b5cae1a9f44982ed3dd38f90d95cba93efbe9fd1e55b0f367e45336f3e68f786"}',
"timestamp": 0,
"event": "BLOCK_PARSED",
"tx_hash": None,
"event_hash": "084f990c96dfcbc724458e54154757258c4b0ecc17255ab42a9c0db2dd4939de",
"event_hash": "895d409a2e1c92470ac8745282bc80bc5317bc193413728450b4c097ff3d1e31",
},
}
],
Expand Down
Loading

0 comments on commit 85e558d

Please sign in to comment.