mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Add pending L1 txs to API
This commit is contained in:
@@ -2634,6 +2634,10 @@ components:
|
|||||||
- example: 2334
|
- example: 2334
|
||||||
nextForgers:
|
nextForgers:
|
||||||
$ref: '#/components/schemas/NextForgers'
|
$ref: '#/components/schemas/NextForgers'
|
||||||
|
pendingL1Transactions:
|
||||||
|
type: number
|
||||||
|
description: Number of pending L1 transactions (added in the smart contract queue but not forged).
|
||||||
|
example: 22
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- lastEthereumBlock
|
- lastEthereumBlock
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ type NetworkAPI struct {
|
|||||||
LastBatch *BatchAPI `json:"lastBatch"`
|
LastBatch *BatchAPI `json:"lastBatch"`
|
||||||
CurrentSlot int64 `json:"currentSlot"`
|
CurrentSlot int64 `json:"currentSlot"`
|
||||||
NextForgers []NextForgerAPI `json:"nextForgers"`
|
NextForgers []NextForgerAPI `json:"nextForgers"`
|
||||||
|
PendingL1Txs int `json:"pendingL1Transactions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodePublicConfig is the configuration of the node that is exposed via API
|
// NodePublicConfig is the configuration of the node that is exposed via API
|
||||||
|
|||||||
@@ -145,11 +145,17 @@ func (u *Updater) UpdateNetworkInfo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Update pending L1s
|
||||||
|
pendingL1s, err := u.hdb.GetUnforgedL1UserTxsCount()
|
||||||
|
if err != nil {
|
||||||
|
return tracerr.Wrap(err)
|
||||||
|
}
|
||||||
u.state.Network.LastSyncBlock = lastSyncBlock.Num
|
u.state.Network.LastSyncBlock = lastSyncBlock.Num
|
||||||
u.state.Network.LastEthBlock = lastEthBlock.Num
|
u.state.Network.LastEthBlock = lastEthBlock.Num
|
||||||
u.state.Network.LastBatch = lastBatch
|
u.state.Network.LastBatch = lastBatch
|
||||||
u.state.Network.CurrentSlot = currentSlot
|
u.state.Network.CurrentSlot = currentSlot
|
||||||
u.state.Network.NextForgers = nextForgers
|
u.state.Network.NextForgers = nextForgers
|
||||||
|
u.state.Network.PendingL1Txs = pendingL1s
|
||||||
u.rw.Unlock()
|
u.rw.Unlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user