Skip to content

Commit

Permalink
refactor: replace backlog term with unconfirmed block pool
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakia committed Mar 7, 2024
1 parent 2fd8593 commit dd8d62e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/getting-started-devs/protocol-reference.md
Expand Up @@ -45,7 +45,7 @@ For a high-level overview of the protocol, review its [design](/design/basics).
- **manual:** local confirmation requests (via rpc)
- handles adding a block to the priority queue
- dependents must be confirmed
- every 5m the scheduler is populated using the backlog
- every 5m the scheduler is populated using the pool of unconfirmed blocks
- when there is a vacancy in the active election container it will check both queues (manual & priority) and add the top block (will be changed in v22.1)
- a block starts of with a passive election state, unless it is added from the priority queue and previously had an election
- upon starting an election, a node will generate & broadcast votes for that election (see [broadcasting a vote](#broadcasting-a-vote))
Expand All @@ -54,7 +54,7 @@ For a high-level overview of the protocol, review its [design](/design/basics).

- <a href="https://github.com/nanocurrency/nano-node/blob/33a974155ddf4b10fc3d2c72e4c20a8abe514aef/nano/node/election_scheduler.cpp#L90-L129" target="_blank">election_scheduler::run</a> — main loop waiting for vacancy
- <a href="https://github.com/nanocurrency/nano-node/blob/33a974155ddf4b10fc3d2c72e4c20a8abe514aef/nano/node/election_scheduler.cpp#L24-L46" target="_blank">election_scheduler::activate</a> — adding a block to the scheduler
- <a href="https://github.com/nanocurrency/nano-node/blob/3135095da26738ba1a08cf2fdba02bdce3fe7abe/nano/node/node.cpp#L1738-L1756" target="_blank">node::populate_backlog</a> — populates scheduler from backlog
- <a href="https://github.com/nanocurrency/nano-node/blob/3135095da26738ba1a08cf2fdba02bdce3fe7abe/nano/node/node.cpp#L1738-L1756" target="_blank">node::populate_backlog</a> — populates scheduler from pool of unconfirmed blocks

---

Expand Down
5 changes: 3 additions & 2 deletions src/core/network/reducer.js
Expand Up @@ -9,11 +9,12 @@ export function networkReducer(state = new Map(), { payload, type }) {
switch (type) {
case networkActions.GET_NETWORK_STATS_FULFILLED: {
const { data } = payload
const backlogMedianPr = data.blockCountMedian_pr - data.cementedMedian_pr
const unconfirmed_transactions_pool_median =
data.blockCountMedian_pr - data.cementedMedian_pr

return state.set('stats', {
...data,
backlogMedianPr
unconfirmed_transactions_pool_median
})
}

Expand Down
13 changes: 9 additions & 4 deletions src/views/components/network/network.js
Expand Up @@ -23,7 +23,7 @@ export default class Network extends React.Component {
const throughputText = `Median number of transactions confirmed per second in the last minute ${prText}`
const speedText =
'Time in milliseconds for a test transaction to get confirmed'
const backlogText = `Median number of transactions waiting to be confirmed ${prText}`
const unconfirmed_pool_text = `Median number of transactions waiting to be confirmed ${prText}`
const stakeText =
'Percentage of delegated Nano weight actively participating in voting'
const confirmText =
Expand Down Expand Up @@ -98,13 +98,18 @@ export default class Network extends React.Component {
</div>
<div className='network__stat'>
<div>
Tx Backlog
<Tooltip title={backlogText}>
Unconfirmed Blocks
<Tooltip title={unconfirmed_pool_text}>
<HelpOutlineIcon fontSize='inherit' />
</Tooltip>
</div>
<div>
{formatNumber(network.getIn(['stats', 'backlogMedianPr'], 0))}
{formatNumber(
network.getIn(
['stats', 'unconfirmed_transactions_pool_median'],
0
)
)}
</div>
</div>
<div className='network__stat'>
Expand Down

0 comments on commit dd8d62e

Please sign in to comment.