From 236bfb71094fe4446ad9c1bde6afdf64ffbbd115 Mon Sep 17 00:00:00 2001 From: aitbc Date: Wed, 20 May 2026 10:23:44 +0200 Subject: [PATCH] fix: use BigInteger for Account balance field - Change Account.balance from INTEGER to BigInteger to support large values - Fixes SQLite INTEGER overflow error when creating accounts from genesis allocations - Allows wallet to receive initial coin allocation from genesis block --- apps/blockchain-node/src/aitbc_chain/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/blockchain-node/src/aitbc_chain/models.py b/apps/blockchain-node/src/aitbc_chain/models.py index 05ae2dc7..820e2f1e 100755 --- a/apps/blockchain-node/src/aitbc_chain/models.py +++ b/apps/blockchain-node/src/aitbc_chain/models.py @@ -3,7 +3,7 @@ import re from typing import List, Optional from pydantic import field_validator -from sqlalchemy import Column +from sqlalchemy import Column, BigInteger from sqlalchemy.types import JSON from sqlmodel import Field, Relationship, SQLModel from sqlalchemy import UniqueConstraint @@ -170,7 +170,7 @@ class Account(SQLModel, table=True): chain_id: str = Field(primary_key=True) address: str = Field(primary_key=True) - balance: int = 0 + balance: int = Field(default=0, sa_type=BigInteger) nonce: int = 0 updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))