Skip to content

Commit 3c59e5a

Browse files
authored
Merge pull request #2845 from CounterpartyXCP/develop
v10.8.0
2 parents 1cdd551 + ff01575 commit 3c59e5a

File tree

18 files changed

+58
-54
lines changed

18 files changed

+58
-54
lines changed

.github/workflows/test_compose.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44
set -x
55

6-
#exit 0
6+
exit 0
77

88
export PATH="/snap/bin:$PATH"
99

.github/workflows/test_compose.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

apiary.apib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ Returns server information and the list of documented routes in JSON format.
14561456
"result": {
14571457
"server_ready": true,
14581458
"network": "mainnet",
1459-
"version": "10.8.0-rc.2",
1459+
"version": "10.8.0",
14601460
"backend_height": 850214,
14611461
"counterparty_height": 850214,
14621462
"documentation": "https://counterpartycore.docs.apiary.io/",

counterparty-core/counterpartycore/lib/api/api_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ def handle_route(**kwargs):
363363
except Exception as e:
364364
capture_exception(e)
365365
logger.error("Error in API: %s", e)
366+
# import traceback
367+
# print(traceback.format_exc())
366368
return return_result(
367369
503, error="Unknown error", start_time=start_time, query_args=query_args
368370
)

counterparty-core/counterpartycore/lib/backend/addrindexrs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,10 @@ def get_oldest_tx(self, address, block_index, timeout=ADDRINDEXRS_CLIENT_TIMEOUT
692692
"block_index": 820321,
693693
"tx_hash": "b61ac3ab1ba9d63d484e8f83e8b9607bd932c8f4b742095445c3527ab575d972",
694694
}, # {}
695+
"842375-bc1q2rn0c89mylzj6c26exda5y2nkezmzh4lh5rkkl": {
696+
"block_index": 842374,
697+
"tx_hash": "3043db292b7f64cbe1cafa32bc733316b162d8a1f41f31a1e6cd224fd5b72415",
698+
},
695699
}
696700
ADDRINDEXRS_CLIENT = None
697701

counterparty-core/counterpartycore/lib/backend/bitcoind.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def rpc_call(payload, retry=0):
8787
f"{response_json['error']} Is `txindex` enabled in {config.BTC_NAME} Core?"
8888
)
8989
elif response_json["error"]["code"] in [-28, -8, -2]:
90-
# "Verifying blocks..." or "Block height out of range" or "The network does not appear to fully agree!"
90+
# "Verifying blocks..." or "Block height out of range" or "The network does not appear to fully agree!""
9191
logger.debug(f"Backend not ready. Sleeping for ten seconds. ({response_json['error']})")
9292
logger.debug(f"Payload: {payload}")
9393
if retry >= 10:
@@ -101,8 +101,15 @@ def rpc_call(payload, retry=0):
101101
else:
102102
raise exceptions.BitcoindRPCError(response_json["error"]["message"])
103103

104+
if isinstance(payload, dict):
105+
method = payload["method"]
106+
elif isinstance(payload, list):
107+
method = payload[0]["method"]
108+
else:
109+
method = "unknown"
104110
elapsed = time.time() - start_time
105-
logger.trace(f"Bitcoin Core RPC call {payload['method']} took {elapsed:.3f}s")
111+
logger.trace(f"Bitcoin Core RPC call {method} took {elapsed:.3f}s")
112+
106113
return result
107114

108115

counterparty-core/counterpartycore/lib/check.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,10 @@
691691
"ledger_hash": "8e55b64d0dfd85a58e3a9dd27ce49efd98559d96f16f53beb66a10b7671ea857",
692692
"txlist_hash": "b3f549168f56702287c7b06c0348c4ac0adffcd219bab386d2f19326c0cd491c",
693693
},
694+
874883: {
695+
"ledger_hash": "4c4d6b660af23bb03a04bbf93ddd0a4b8e615dd7b883ecf827274cabe658bfc2",
696+
"txlist_hash": "f6a99d60337c33c1822c048f56e241455cd7e45bb5a9515096f1ac609d50f669",
697+
},
694698
}
695699

696700
CONSENSUS_HASH_VERSION_TESTNET = 7
@@ -1114,5 +1118,6 @@ def database_version(db):
11141118
message = "`VERSION_STRING` not found in dataase. "
11151119
else:
11161120
message = f"Client pre-release version number mismatch: {version_pre_release}{config.VERSION_PRE_RELEASE}. "
1117-
message += "Checking if a reparse is needed..."
1121+
message += "Checking if a rollback or a reparse is needed..."
1122+
check_need_rollback(version_minor, message)
11181123
check_need_reparse(version_minor, message)

counterparty-core/counterpartycore/lib/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
# Semantic Version
8-
__version__ = "10.8.0-rc.2" # for hatch
8+
__version__ = "10.8.0" # for hatch
99
VERSION_STRING = __version__
1010
version = VERSION_STRING.split("-")[0].split(".")
1111
VERSION_MAJOR = int(version[0])
@@ -155,7 +155,7 @@
155155
# Custom exit codes
156156
EXITCODE_UPDATE_REQUIRED = 5
157157

158-
BACKEND_RAW_TRANSACTIONS_CACHE_SIZE = 20000
158+
BACKEND_RAW_TRANSACTIONS_CACHE_SIZE = 1000
159159
BACKEND_RPC_BATCH_NUM_WORKERS = 6
160160

161161
DEFAULT_UTXO_LOCKS_MAX_ADDRESSES = 1000

counterparty-core/counterpartycore/lib/gettxinfo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,8 @@ def get_op_return_vout(decoded_tx):
741741

742742

743743
KNOWN_SOURCES = {
744-
"92ad58f5aa35c503489efbdd2a466e942baa9ac5cd67cb7544adf03e47a457d0": "a71da7169db3672408c7b25f84be425839548e63fa480c0478f91e3c2aa3ec67:0"
744+
"92ad58f5aa35c503489efbdd2a466e942baa9ac5cd67cb7544adf03e47a457d0": "a71da7169db3672408c7b25f84be425839548e63fa480c0478f91e3c2aa3ec67:0",
745+
"c80143886181ebbc782d23a50acca0f5ea7ac005d3164d7c76fc5e14f72d47c8": "",
745746
}
746747

747748

counterparty-core/counterpartycore/lib/mempool.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,22 +131,22 @@ def parse_raw_mempool(db):
131131
timestamps = {}
132132
cursor = db.cursor()
133133
logger.debug(f"Found {len(raw_mempool)} transaction(s) in the mempool...")
134+
txhash_list = []
134135
for txid, tx_info in raw_mempool.items():
135136
existing_tx_in_mempool = cursor.execute(
136137
"SELECT * FROM mempool WHERE tx_hash = ? LIMIT 1", (txid,)
137138
).fetchone()
138139
if existing_tx_in_mempool:
139140
continue
140-
try:
141-
logger.trace(f"Getting raw transaction `{txid}` from the mempool...")
142-
raw_tx = backend.bitcoind.getrawtransaction(txid)
143-
raw_tx_list.append(raw_tx)
144-
timestamps[txid] = tx_info["time"]
145-
except exceptions.BitcoindRPCError as e:
146-
if "No such mempool or blockchain transaction" in str(e):
147-
pass
148-
else:
149-
raise e
141+
txhash_list.append(txid)
142+
timestamps[txid] = tx_info["time"]
143+
144+
logger.debug(f"Getting {len(txhash_list)} raw transactions by batch from the mempool...")
145+
raw_transactions_by_hash = backend.addrindexrs.getrawtransaction_batch(
146+
txhash_list, skip_missing=True
147+
)
148+
raw_tx_list = [raw_hex for raw_hex in raw_transactions_by_hash.values() if raw_hex is not None]
149+
150150
logger.debug(f"Parsing {len(raw_tx_list)} transaction(s) from the mempool...")
151151
parse_mempool_transactions(db, raw_tx_list, timestamps)
152152
logger.debug("Raw mempool parsed successfully.")

counterparty-core/counterpartycore/server.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -988,13 +988,18 @@ def bootstrap(no_confirm=False, snapshot_url=None):
988988
if config.TESTNET:
989989
ledger_database_path += ".testnet"
990990
ledger_database_path += ".db"
991-
api_database_path = ledger_database_path.replace(".db", ".api.db")
991+
992+
old_api_database_path = ledger_database_path.replace(".db", ".api.db")
993+
if config.TESTNET:
994+
api_database_path = os.path.join(config.DATA_DIR, "state.testnet.db")
995+
else:
996+
api_database_path = os.path.join(config.DATA_DIR, "state.db")
992997

993998
# Prepare Directory.
994999
if not os.path.exists(config.DATA_DIR):
9951000
os.makedirs(config.DATA_DIR, mode=0o755)
9961001

997-
for database_path in [ledger_database_path, api_database_path]:
1002+
for database_path in [ledger_database_path, api_database_path, old_api_database_path]:
9981003
if os.path.exists(database_path):
9991004
os.remove(database_path)
10001005
# Delete SQLite Write-Ahead-Log
@@ -1037,10 +1042,13 @@ def bootstrap_progress(blocknum, blocksize, totalsize):
10371042
tar_file.extractall(path=config.DATA_DIR) # nosec B202 # noqa: S202
10381043

10391044
assert os.path.exists(ledger_database_path)
1040-
assert os.path.exists(api_database_path)
1045+
assert os.path.exists(api_database_path) or os.path.exists(old_api_database_path)
10411046
# user and group have "rw" access
10421047
os.chmod(ledger_database_path, 0o660) # nosec B103
1043-
os.chmod(api_database_path, 0o660) # nosec B103
1048+
if os.path.exists(api_database_path):
1049+
os.chmod(api_database_path, 0o660) # nosec B103
1050+
if os.path.exists(old_api_database_path):
1051+
os.chmod(old_api_database_path, 0o660) # nosec B103
10441052

10451053
with log.Spinner("Cleaning up..."):
10461054
os.remove(tarball_path)

counterparty-core/counterpartycore/test/regtest/apidoc/blueprint-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Returns server information and the list of documented routes in JSON format.
165165
"result": {
166166
"server_ready": true,
167167
"network": "mainnet",
168-
"version": "10.8.0-rc.2",
168+
"version": "10.8.0",
169169
"backend_height": 850214,
170170
"counterparty_height": 850214,
171171
"documentation": "https://counterpartycore.docs.apiary.io/",

counterparty-core/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ gunicorn==23.0.0
3636
waitress==3.0.1
3737
hypothesis==6.116.0
3838
bitcoin-utils==0.7.1
39-
counterparty-rs==10.8.0-rc.2
39+
counterparty-rs==10.8.0

counterparty-rs/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

counterparty-rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "counterparty-rs"
3-
version = "10.8.0-rc.2"
3+
version = "10.8.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

counterparty-wallet/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ colorlog==6.8.0
55
python-dateutil==2.8.2
66
requests==2.32.0
77
termcolor==2.4.0
8-
counterparty-core==10.8.0-rc.2
8+
counterparty-core==10.8.0

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ x-addrindexrs-common: &addrindexrs-common
1515
restart: unless-stopped
1616

1717
x-counterparty-common: &counterparty-common
18-
image: counterparty/counterparty:v10.8.0-rc.2
18+
image: counterparty/counterparty:v10.8.0
1919
stop_grace_period: 1m
2020
volumes:
2121
- data:/root/.bitcoin

release-notes/release-notes-v10.8.0.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This release includes some significant architectural changes to the codebase to
55

66
# Upgrading
77

8-
This upgrade requires a mandatory, automatic reparse from block 871780.
8+
This upgrade requires a mandatory, automatic rollback from block 871780.
99

1010

1111
# ChangeLog
@@ -47,6 +47,8 @@ This upgrade requires a mandatory, automatic reparse from block 871780.
4747
- Exclude transactions by `SIGHASH`
4848
- Be able to trigger a rollback on a minor version change
4949
- Add several new checkpoints
50+
- Parse raw mempool by batch before following
51+
- Set `BACKEND_RAW_TRANSACTIONS_CACHE_SIZE` to 1000
5052

5153
## API
5254

0 commit comments

Comments
 (0)