Skip to content

Simplified version of Block Clock#212

Closed
shaavan wants to merge 7 commits into
bitcoin-core:mainfrom
shaavan:221216-the_block_clock_simplified
Closed

Simplified version of Block Clock#212
shaavan wants to merge 7 commits into
bitcoin-core:mainfrom
shaavan:221216-the_block_clock_simplified

Conversation

@shaavan
Copy link
Copy Markdown
Contributor

@shaavan shaavan commented Dec 16, 2022

This PR is the simplified version of #148. And removes commits in #127 to allow easier upstream commit merges.

Functional changes from the original version:

  1. The PeersIndicator has been replaced with plain rectangles to keep the UI intact.
  2. The conns property representing if the number of connections is greater than 0, has been set to always positive. With this change, the "connecting" page, though implemented, becomes inaccessible through the UI.

- This method would allow to get the blocktime value of the block at
  the given height.
- This file allowing using of Chain interfaces to get information about
  the blockchain.
- This class declares and defines the function that will be used in
  for the Block Clock.
1. Added a new Q_PROPERTY to track the remaining time till the IBD
   completioni.
2. Added two signals to later connect to the chainmodel class function.
3. Added new member variable, m_pause, which will keep track of if the
   block clock is in paused state or not, and will accordingly
disconnect or reconnect the user to network.
- Also made appropriate connections with the nodemodel signals
- This property will later be used for the BlockClock.qml file
- The BlockClock.qml files provides the control for BlockClock and
  determines how the elements would be displayed.
- The BlockClockComponent.qml file uses the aforementioned control to
  display the value, and determines what will be displayed.
@johnny9
Copy link
Copy Markdown
Collaborator

johnny9 commented Dec 17, 2022

On Ubuntu 22.04.1 LTS, I had to install apt install qml-module-qtgraphicaleffects for the application to load otherwise I receive the error

QQmlApplicationEngine failed to load component
qrc:/qml/pages/main.qml:53:13: Type NodeRunner unavailable
qrc:/qml/pages/node/NodeRunner.qml:24:9: Type BlockClockComponent unavailable
qrc:/qml/components/BlockClockComponent.qml:6:1: Type BlockClock unavailable
qrc:/qml/controls/BlockClock.qml:4:1: module "QtGraphicalEffects" is not installed

Might want to extend the README for the qml directory to include that module.

@johnny9
Copy link
Copy Markdown
Collaborator

johnny9 commented Dec 17, 2022

It looks great. Tested pause/resume as well as a sync on signet and here's what I got.

Screenshot_2022-12-16_22-18-31 Screenshot_2022-12-16_22-19-02 Screenshot_2022-12-16_22-25-01 Screenshot_2022-12-16_22-26-42 Screenshot_2022-12-16_22-28-51

Copy link
Copy Markdown
Collaborator

@johnny9 johnny9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some QML errors appear during runtime. tail -f debug.log | grep GUI to watch for issues when running bitcoin-qt.

Comment thread src/qml/chainmodel.h
interfaces::Chain& m_chain;
};

#endif // BITCOIN_QML_CHAINMODEL_H No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"No newline at end of file"


Component.onCompleted: nodeModel.startNodeInitializionThread();

BlockClockComponent{}
Copy link
Copy Markdown
Collaborator

@johnny9 johnny9 Dec 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GUI: qrc:/qml/pages/node/NodeRunner.qml:24:9: QML BlockClockComponent: Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.

Should be able to remove the ColumnLayout containing the BlockClockComponent and just define the BlockClockComponent as the content to this Page. When you do this, also remove the anchors.fill: parent and spacing: 0 in this file.

else {
var del = 0.0025
// Paint Block time points
for (var i=1; i<parent.blockList.length - 1; i++) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following error appears when going into the paused state.

2022-12-17T03:50:17Z GUI: qrc:/qml/controls/BlockClock.qml:96: TypeError: Value is undefined and could not be converted to an object

Copy link
Copy Markdown
Collaborator

@johnny9 johnny9 Dec 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a small style thing, put spaces before and after operators so its easier to read.

ringProgress: blockList[0]
header: Math.floor(nodeModel.blockTipHeight / 1000) + "," + nodeModel.blockTipHeight % 1000
subText: "Blocktime"
blockList: chainModel.timeRatioList
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QML error appears when shutting down.

2022-12-17T03:52:37Z Shutdown: In progress...
2022-12-17T03:52:37Z torcontrol thread exit
2022-12-17T03:52:37Z addcon thread exit
2022-12-17T03:52:37Z msghand thread exit
2022-12-17T03:52:37Z net thread exit
2022-12-17T03:52:39Z opencon thread exit
2022-12-17T03:52:39Z DumpAnchors: Flush 0 outbound block-relay-only peer addresses to anchors.dat started
2022-12-17T03:52:39Z DumpAnchors: Flush 0 outbound block-relay-only peer addresses to anchors.dat completed (0.01s)
2022-12-17T03:52:39Z scheduler thread exit
2022-12-17T03:52:39Z Writing 0 unbroadcast transactions to disk.
2022-12-17T03:52:39Z Dumped mempool: 3.7e-06s to copy, 0.00448635s to dump
2022-12-17T03:52:39Z Shutdown: done
2022-12-17T03:52:39Z GUI: qrc:/qml/components/BlockClockComponent.qml:34: TypeError: Cannot read property 'timeRatioList' of null

Comment thread src/qml/chainmodel.cpp
m_time_ratio_list.erase(m_time_ratio_list.begin() + 1, m_time_ratio_list.end());
}
m_time_ratio_list[0] = currentTimeRatio;
} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"No new line at end of file"

@shaavan
Copy link
Copy Markdown
Contributor Author

shaavan commented Dec 18, 2022

Moved the changes of this PR to #148 to preserve comment history for the block_clock and prevent the splitting of discussion between two PRs.

@johnny9, I shall be addressing your comments here and in #148. Thanks for your cooperation.

@shaavan shaavan closed this Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants