fix: use BigInteger for Account balance field
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Successful in 10s
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 14s
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Successful in 5s
Integration Tests / test-service-integration (push) Failing after 3s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Successful in 4s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 11s
Node Failover Simulation / failover-test (push) Failing after 3s
P2P Network Verification / p2p-verification (push) Successful in 8s
Python Tests / test-python (push) Failing after 49s
Cross-Chain Functionality Tests / aggregate-results (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled

- 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
This commit is contained in:
aitbc
2026-05-20 10:23:44 +02:00
parent e8c13065b4
commit 236bfb7109

View File

@@ -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))