forked from spectre-project/spectre-rest-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlock.py
42 lines (36 loc) · 1.08 KB
/
Block.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from sqlalchemy import (
Column,
String,
Float,
Boolean,
Integer,
BigInteger,
TIMESTAMP,
Index,
)
from sqlalchemy.dialects.postgresql import ARRAY
from dbsession import Base
class Block(Base):
__tablename__ = "blocks"
hash = Column(String, primary_key=True)
accepted_id_merkle_root = Column(String)
difficulty = Column(Float)
# childrenHashes = Column(JSONB)
is_chain_block = Column(Boolean)
merge_set_blues_hashes = Column(ARRAY(String))
merge_set_reds_hashes = Column(ARRAY(String))
selected_parent_hash = Column(String)
bits = Column(Integer)
blue_score = Column(BigInteger)
blue_work = Column(String)
daa_score = Column(BigInteger)
hash_merkle_root = Column(String)
nonce = Column(String)
parents = Column(ARRAY(String))
pruning_point = Column(String)
timestamp = Column(TIMESTAMP(timezone=False))
utxo_commitment = Column(String)
version = Column(Integer)
Index("block_chainblock", Block.is_chain_block)
Index("idx_blue_score", Block.blue_score)
Index("idx_daa_score", Block.daa_score)