Skip to content

Commit

Permalink
add back accidentally removed code and simplify related code
Browse files Browse the repository at this point in the history
  • Loading branch information
HarukaMa committed Mar 5, 2023
1 parent 626ab50 commit 764d48e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions node/types/vm_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -2220,6 +2220,9 @@ def load(cls, data: bytearray):
transactions = Vec[Transaction, u32].load(data)
return cls(transactions=transactions)

def __iter__(self):
return iter(self.transactions)


class BlockHeaderMetadata(Serialize, Deserialize):
version = u16()
Expand Down
10 changes: 5 additions & 5 deletions webui/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ async def block_route(request: Request):
target_sum += solution["target"]

txs = []
for tx in block.transactions.transactions:
for tx in block.transactions:
tx: Transaction
match tx.type:
case Transaction.Type.Deploy:
Expand Down Expand Up @@ -247,7 +247,7 @@ async def transaction_route(request: Request):

transaction: DeployTransaction | ExecuteTransaction | None = None
transaction_type = ""
for tx in block.transactions.transactions:
for tx in block.transactions:
match tx.type:
case Transaction.Type.Deploy:
tx: DeployTransaction
Expand Down Expand Up @@ -346,7 +346,7 @@ async def transition_route(request: Request):

transaction_id = None
transition = None
for tx in block.transactions.transactions:
for tx in block.transactions:
if tx.type == Transaction.Type.Deploy:
tx: DeployTransaction
if str(tx.fee.transition.id) == ts_id:
Expand Down Expand Up @@ -843,7 +843,7 @@ async def advanced_route(request: Request):
block = await db.get_block_from_transaction_id(obj)
if block is None:
raise HTTPException(status_code=404, detail="Transaction not found")
for tx in block.transactions.transactions:
for tx in block.transactions:
match tx.type:
case Transaction.Type.Execute:
tx: ExecuteTransaction
Expand Down Expand Up @@ -871,7 +871,7 @@ async def advanced_route(request: Request):
block = await db.get_block_from_transition_id(obj)
if block is None:
raise HTTPException(status_code=404, detail="Transition not found")
for tx in block.transactions.transactions:
for tx in block.transactions:
if tx.type == Transaction.Type.Execute:
tx: ExecuteTransaction
for ts in tx.execution.transitions:
Expand Down

0 comments on commit 764d48e

Please sign in to comment.