From 9b7118f0861d8e589443f325b02c7162b7fcff14 Mon Sep 17 00:00:00 2001 From: Ouziel Slama Date: Thu, 17 Oct 2024 17:46:16 +0000 Subject: [PATCH 1/7] Fix event parsing --- counterparty-core/counterpartycore/lib/api/api_watcher.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/counterparty-core/counterpartycore/lib/api/api_watcher.py b/counterparty-core/counterpartycore/lib/api/api_watcher.py index 55900a8e85..a356ed740b 100644 --- a/counterparty-core/counterpartycore/lib/api/api_watcher.py +++ b/counterparty-core/counterpartycore/lib/api/api_watcher.py @@ -402,6 +402,12 @@ def update_assets_info(api_db, event): "SELECT * FROM assets_info WHERE asset = :asset", {"asset": event_bindings["asset"]}, ) + if existing_asset is None and "asset_longname" in event_bindings: + existing_asset = fetch_one( + api_db, + "SELECT * FROM assets_info WHERE asset_longname = :asset_longname", + {"asset_longname": event_bindings["asset_longname"]}, + ) if existing_asset is not None and not event_bindings["confirmed"]: return set_data = [] From 1b8fa80e01ef163252ef3d45490d670ed20065b1 Mon Sep 17 00:00:00 2001 From: Ouziel Slama Date: Thu, 17 Oct 2024 17:59:52 +0000 Subject: [PATCH 2/7] Fix fairminter events rollback --- counterparty-core/counterpartycore/lib/api/api_watcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/counterparty-core/counterpartycore/lib/api/api_watcher.py b/counterparty-core/counterpartycore/lib/api/api_watcher.py index a356ed740b..931bbdee14 100644 --- a/counterparty-core/counterpartycore/lib/api/api_watcher.py +++ b/counterparty-core/counterpartycore/lib/api/api_watcher.py @@ -636,9 +636,9 @@ def update_fairminters(api_db, event): def rollback_fairminters(api_db, event): if event["event"] != "NEW_FAIRMINT": return - if event["status"] != "valid": - return event_bindings = json.loads(event["bindings"]) + if event_bindings["status"] != "valid": + return cursor = api_db.cursor() sql = """ UPDATE fairminters SET From 7c23493a61b464d80119917db139ccda40fb01b8 Mon Sep 17 00:00:00 2001 From: Adam Krellenstein Date: Thu, 17 Oct 2024 14:06:12 -0400 Subject: [PATCH 3/7] Release Notes for v10.4.8 --- release-notes/release-notes-v10.4.8.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 release-notes/release-notes-v10.4.8.md diff --git a/release-notes/release-notes-v10.4.8.md b/release-notes/release-notes-v10.4.8.md new file mode 100644 index 0000000000..ab880f9b0c --- /dev/null +++ b/release-notes/release-notes-v10.4.8.md @@ -0,0 +1,26 @@ +# Release Notes - Counterparty Core v10.4.8 (2024-10-17) + +This is a hotfix release to fix a number of additional issues that arose with the recent protocol changes. + +# Upgrading + +# ChangeLog + +## Bugfixes + +- Fix fair minting rollback +- Fix API server crash due to missing sanity check + +## Codebase + +## API + +## CLI + + + +# Credits + +* Ouziel Slama +* Warren Puffett +* Adam Krellenstein From 58d46c49e3d4f14e22606dc70b9c6362d019755d Mon Sep 17 00:00:00 2001 From: Ouziel Slama Date: Thu, 17 Oct 2024 18:22:50 +0000 Subject: [PATCH 4/7] Retry max 10 times on error -8 --- .../counterpartycore/lib/backend/bitcoind.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/counterparty-core/counterpartycore/lib/backend/bitcoind.py b/counterparty-core/counterpartycore/lib/backend/bitcoind.py index 4378d2ba47..f5ed783c2e 100644 --- a/counterparty-core/counterpartycore/lib/backend/bitcoind.py +++ b/counterparty-core/counterpartycore/lib/backend/bitcoind.py @@ -18,7 +18,7 @@ TRANSACTIONS_CACHE_MAX_SIZE = 10000 -def rpc_call(payload): +def rpc_call(payload, retry=0): """Calls to bitcoin core and returns the response""" url = config.BACKEND_URL response = None @@ -89,10 +89,15 @@ def rpc_call(payload): if response_json["error"]["code"] in [-28, -8, -2]: # “Verifying blocks...” or “Block height out of range” or “The network does not appear to fully agree!“ logger.debug(f"Backend not ready. Sleeping for ten seconds. ({response_json['error']})") + logger.debug(f"Payload: {payload}") + if retry >= 10: + raise exceptions.BitcoindRPCError( + f"Backend not ready after {retry} retries. ({response_json['error']})" + ) # If Bitcoin Core takes more than `sys.getrecursionlimit() * 10 = 9970` # seconds to start, this’ll hit the maximum recursion depth limit. time.sleep(10) - return rpc_call(payload) + return rpc_call(payload, retry=retry + 1) raise exceptions.BitcoindRPCError(response_json["error"]["message"]) From 5e469d4d916a3b7f52674f46f103949d65da0de7 Mon Sep 17 00:00:00 2001 From: Ouziel Slama Date: Thu, 17 Oct 2024 18:31:20 +0000 Subject: [PATCH 5/7] Update release notes --- release-notes/release-notes-v10.4.8.md | 1 + 1 file changed, 1 insertion(+) diff --git a/release-notes/release-notes-v10.4.8.md b/release-notes/release-notes-v10.4.8.md index ab880f9b0c..b7b6ab2b4c 100644 --- a/release-notes/release-notes-v10.4.8.md +++ b/release-notes/release-notes-v10.4.8.md @@ -10,6 +10,7 @@ This is a hotfix release to fix a number of additional issues that arose with th - Fix fair minting rollback - Fix API server crash due to missing sanity check +- Retry maximum 10 times on Bitcoin Core RPC call error ## Codebase From 3e04276088cba0daedb4a0250483e7242ea907a9 Mon Sep 17 00:00:00 2001 From: Ouziel Slama Date: Thu, 17 Oct 2024 18:41:01 +0000 Subject: [PATCH 6/7] Bump version --- apiary.apib | 2 +- counterparty-core/counterpartycore/lib/config.py | 2 +- .../counterpartycore/test/regtest/apidoc/blueprint-template.md | 2 +- counterparty-core/requirements.txt | 2 +- counterparty-rs/Cargo.lock | 2 +- counterparty-rs/Cargo.toml | 2 +- counterparty-wallet/requirements.txt | 2 +- docker-compose.yml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apiary.apib b/apiary.apib index fff768d1a8..b7c7e99e5e 100644 --- a/apiary.apib +++ b/apiary.apib @@ -1437,7 +1437,7 @@ Returns server information and the list of documented routes in JSON format. "result": { "server_ready": true, "network": "mainnet", - "version": "10.4.7", + "version": "10.4.8", "backend_height": 850214, "counterparty_height": 850214, "documentation": "https://counterpartycore.docs.apiary.io/", diff --git a/counterparty-core/counterpartycore/lib/config.py b/counterparty-core/counterpartycore/lib/config.py index 26dada3364..a03a3ca794 100644 --- a/counterparty-core/counterpartycore/lib/config.py +++ b/counterparty-core/counterpartycore/lib/config.py @@ -5,7 +5,7 @@ # Semantic Version -__version__ = "10.4.7" # for hatch +__version__ = "10.4.8" # for hatch VERSION_STRING = __version__ version = VERSION_STRING.split("-")[0].split(".") VERSION_MAJOR = int(version[0]) diff --git a/counterparty-core/counterpartycore/test/regtest/apidoc/blueprint-template.md b/counterparty-core/counterpartycore/test/regtest/apidoc/blueprint-template.md index 80db9e76e3..59898af79b 100644 --- a/counterparty-core/counterpartycore/test/regtest/apidoc/blueprint-template.md +++ b/counterparty-core/counterpartycore/test/regtest/apidoc/blueprint-template.md @@ -158,7 +158,7 @@ Returns server information and the list of documented routes in JSON format. "result": { "server_ready": true, "network": "mainnet", - "version": "10.4.7", + "version": "10.4.8", "backend_height": 850214, "counterparty_height": 850214, "documentation": "https://counterpartycore.docs.apiary.io/", diff --git a/counterparty-core/requirements.txt b/counterparty-core/requirements.txt index 1cf340422e..b4492640d7 100644 --- a/counterparty-core/requirements.txt +++ b/counterparty-core/requirements.txt @@ -34,4 +34,4 @@ JSON-log-formatter==1.0 yoyo-migrations==8.2.0 gunicorn==23.0.0 waitress==3.0.0 -counterparty-rs==10.4.7 +counterparty-rs==10.4.8 diff --git a/counterparty-rs/Cargo.lock b/counterparty-rs/Cargo.lock index 03da844c4c..0915e07fb5 100644 --- a/counterparty-rs/Cargo.lock +++ b/counterparty-rs/Cargo.lock @@ -382,7 +382,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "counterparty-rs" -version = "10.4.7" +version = "10.4.8" dependencies = [ "bip32", "bitcoin 0.29.2", diff --git a/counterparty-rs/Cargo.toml b/counterparty-rs/Cargo.toml index 7681042e5f..24be1c78a3 100644 --- a/counterparty-rs/Cargo.toml +++ b/counterparty-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "counterparty-rs" -version = "10.4.7" +version = "10.4.8" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/counterparty-wallet/requirements.txt b/counterparty-wallet/requirements.txt index 90ba237696..f182932daf 100644 --- a/counterparty-wallet/requirements.txt +++ b/counterparty-wallet/requirements.txt @@ -5,4 +5,4 @@ colorlog==6.8.0 python-dateutil==2.8.2 requests==2.32.0 termcolor==2.4.0 -counterparty-core==10.4.7 +counterparty-core==10.4.8 diff --git a/docker-compose.yml b/docker-compose.yml index c300e14352..c9f7634940 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ x-addrindexrs-common: &addrindexrs-common restart: unless-stopped x-counterparty-common: &counterparty-common - image: counterparty/counterparty:v10.4.7 + image: counterparty/counterparty:v10.4.8 stop_grace_period: 1m volumes: - data:/root/.bitcoin From a571d1ab137a3a11a0bebd006a709a65762cfee4 Mon Sep 17 00:00:00 2001 From: Adam Krellenstein Date: Thu, 17 Oct 2024 15:29:57 -0400 Subject: [PATCH 7/7] Release Notes for v10.4.8 --- release-notes/release-notes-v10.4.8.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release-notes/release-notes-v10.4.8.md b/release-notes/release-notes-v10.4.8.md index b7b6ab2b4c..2ef9f14326 100644 --- a/release-notes/release-notes-v10.4.8.md +++ b/release-notes/release-notes-v10.4.8.md @@ -4,6 +4,9 @@ This is a hotfix release to fix a number of additional issues that arose with th # Upgrading +This is not a protocol change, and no database reparsing is necessary. + + # ChangeLog ## Bugfixes