File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 12
12
#include < primitives/block.h>
13
13
#include < sync.h>
14
14
#include < uint256.h>
15
+ #include < util/time.h>
15
16
16
17
#include < vector>
17
18
@@ -275,6 +276,11 @@ class CBlockIndex
275
276
*/
276
277
bool HaveTxsDownloaded () const { return nChainTx != 0 ; }
277
278
279
+ NodeSeconds Time () const
280
+ {
281
+ return NodeSeconds{std::chrono::seconds{nTime}};
282
+ }
283
+
278
284
int64_t GetBlockTime () const
279
285
{
280
286
return (int64_t )nTime;
Original file line number Diff line number Diff line change 8
8
9
9
#include < uint256.h>
10
10
11
+ #include < chrono>
11
12
#include < limits>
12
13
#include < map>
13
14
@@ -109,6 +110,10 @@ struct Params {
109
110
bool fPowNoRetargeting ;
110
111
int64_t nPowTargetSpacing;
111
112
int64_t nPowTargetTimespan;
113
+ std::chrono::seconds PowTargetSpacing () const
114
+ {
115
+ return std::chrono::seconds{nPowTargetSpacing};
116
+ }
112
117
int64_t DifficultyAdjustmentInterval () const { return nPowTargetTimespan / nPowTargetSpacing; }
113
118
/* * The best chain should have at least this much work */
114
119
uint256 nMinimumChainWork;
Original file line number Diff line number Diff line change 9
9
#include < primitives/transaction.h>
10
10
#include < serialize.h>
11
11
#include < uint256.h>
12
+ #include < util/time.h>
12
13
13
14
/* * Nodes collect new transactions into a block, hash them into a hash tree,
14
15
* and scan through nonce values to make the block's hash satisfy proof-of-work
@@ -52,6 +53,11 @@ class CBlockHeader
52
53
53
54
uint256 GetHash () const ;
54
55
56
+ NodeSeconds Time () const
57
+ {
58
+ return NodeSeconds{std::chrono::seconds{nTime}};
59
+ }
60
+
55
61
int64_t GetBlockTime () const
56
62
{
57
63
return (int64_t )nTime;
You can’t perform that action at this time.
0 commit comments