Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
defunctec
crown-core
Commits
62ae1c3f
Commit
62ae1c3f
authored
7 years ago
by
Jonas Schnelli
Browse files
Options
Download
Email Patches
Plain Diff
Declare headers height/time cache mutable, re-set the methods const
parent
705623ce
v0.14.2
v0.14.2rc2
v0.14.2rc1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/qt/clientmodel.cpp
+2
-2
src/qt/clientmodel.cpp
src/qt/clientmodel.h
+4
-4
src/qt/clientmodel.h
with
6 additions
and
6 deletions
+6
-6
src/qt/clientmodel.cpp
View file @
62ae1c3f
...
...
@@ -74,7 +74,7 @@ int ClientModel::getNumBlocks() const
return
chainActive
.
Height
();
}
int
ClientModel
::
getHeaderTipHeight
()
int
ClientModel
::
getHeaderTipHeight
()
const
{
if
(
cachedBestHeaderHeight
==
-
1
)
{
// make sure we initially populate the cache via a cs_main lock
...
...
@@ -87,7 +87,7 @@ int ClientModel::getHeaderTipHeight()
return
cachedBestHeaderHeight
;
}
int64_t
ClientModel
::
getHeaderTipTime
()
int64_t
ClientModel
::
getHeaderTipTime
()
const
{
if
(
cachedBestHeaderTime
==
-
1
)
{
LOCK
(
cs_main
);
...
...
This diff is collapsed.
Click to expand it.
src/qt/clientmodel.h
View file @
62ae1c3f
...
...
@@ -51,8 +51,8 @@ public:
//! Return number of connections, default is in- and outbound (total)
int
getNumConnections
(
unsigned
int
flags
=
CONNECTIONS_ALL
)
const
;
int
getNumBlocks
()
const
;
int
getHeaderTipHeight
();
int64_t
getHeaderTipTime
();
int
getHeaderTipHeight
()
const
;
int64_t
getHeaderTipTime
()
const
;
//! Return number of transactions in the mempool
long
getMempoolSize
()
const
;
//! Return the dynamic memory usage of the mempool
...
...
@@ -82,8 +82,8 @@ public:
QString
dataDir
()
const
;
// caches for the best header
std
::
atomic
<
int
>
cachedBestHeaderHeight
;
std
::
atomic
<
int64_t
>
cachedBestHeaderTime
;
mutable
std
::
atomic
<
int
>
cachedBestHeaderHeight
;
mutable
std
::
atomic
<
int64_t
>
cachedBestHeaderTime
;
private:
OptionsModel
*
optionsModel
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help