File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -2701,7 +2701,7 @@ bool CWallet::CreateCoinStake(
27012701 int nAttempts = 0 ;
27022702
27032703 // update staker status (hash)
2704- pStakerStatus->SetLastHash (pindexPrev-> GetBlockHash () );
2704+ pStakerStatus->SetLastTip (pindexPrev);
27052705
27062706 for (std::unique_ptr<CStakeInput>& stakeInput : listInputs) {
27072707 // new block came in, move on
Original file line number Diff line number Diff line change @@ -147,19 +147,23 @@ class CKeyPool
147147 }
148148};
149149
150- /* * Record metadata about last kernel stake operation (time and prev hash )**/
150+ /* * Record info about last kernel stake operation (time and chainTip )**/
151151class CStakerStatus {
152152private:
153- uint256 hashLastStakeAttempt ;
153+ const CBlockIndex* tipLastStakeAttempt ;
154154 int64_t timeLastStakeAttempt;
155155public:
156- uint256 GetLastHash () const { return hashLastStakeAttempt; }
156+ const CBlockIndex* GetLastTip () const { return tipLastStakeAttempt; }
157+ uint256 GetLastHash () const
158+ {
159+ return (tipLastStakeAttempt == nullptr ? 0 : tipLastStakeAttempt->GetBlockHash ());
160+ }
157161 int64_t GetLastTime () const { return timeLastStakeAttempt; }
158- void SetLastHash (const uint256& lastHash ) { hashLastStakeAttempt = lastHash ; }
162+ void SetLastTip (const CBlockIndex* lastTip ) { tipLastStakeAttempt = lastTip ; }
159163 void SetLastTime (const uint64_t lastTime) { timeLastStakeAttempt = lastTime; }
160- void Update (const uint256& lastHash , const uint64_t lastTime)
164+ void Update (CBlockIndex* lastTip , const uint64_t lastTime)
161165 {
162- SetLastHash (lastHash );
166+ SetLastTip (lastTip );
163167 SetLastTime (lastTime);
164168 }
165169 bool IsActive () { return (timeLastStakeAttempt + 30 ) >= GetTime (); }
You can’t perform that action at this time.
0 commit comments