fix: Specify char set

This commit is contained in:
Nathan Woodburn 2025-02-05 23:16:28 +11:00
parent f8c364e874
commit 449e35fd03
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -97,8 +97,8 @@ def saveBlock(blockData):
def setupDB():
"""Creates the database tables"""
with db.cursor() as cursor:
cursor.execute("CREATE TABLE IF NOT EXISTS blocks (hash VARCHAR(64), height BIGINT, depth INT, version INT, prevBlock VARCHAR(64), merkleRoot VARCHAR(64), witnessRoot VARCHAR(64), treeRoot VARCHAR(64), reservedRoot VARCHAR(64), time INT, bits INT, nonce BIGINT UNSIGNED, extraNonce VARCHAR(64), mask VARCHAR(64), txs JSON)")
cursor.execute("CREATE TABLE IF NOT EXISTS transactions (hash VARCHAR(64), witnessHash VARCHAR(64), fee BIGINT, rate BIGINT, mtime BIGINT, block BIGINT, `index` INT, version INT, inputs JSON, outputs JSON, locktime BIGINT, hex LONGTEXT)")
cursor.execute("CREATE TABLE IF NOT EXISTS blocks (hash VARCHAR(64), height BIGINT, depth INT, version INT, prevBlock VARCHAR(64), merkleRoot VARCHAR(64), witnessRoot VARCHAR(64), treeRoot VARCHAR(64), reservedRoot VARCHAR(64), time INT, bits INT, nonce BIGINT UNSIGNED, extraNonce VARCHAR(64), mask VARCHAR(64), txs JSON) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci")
cursor.execute("CREATE TABLE IF NOT EXISTS transactions (hash VARCHAR(64), witnessHash VARCHAR(64), fee BIGINT, rate BIGINT, mtime BIGINT, block BIGINT, `index` INT, version INT, inputs JSON, outputs JSON, locktime BIGINT, hex LONGTEXT) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci")
# Get the newest block height in the database
def getNewestBlock() -> int:
@ -184,9 +184,6 @@ def getFirstMissingBlock():
return block
async def main():
blockWatcher = BlockWatcher(HSD_URL)
blockWatcher.start()