File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3936,9 +3936,11 @@ CKeyPool::CKeyPool(const CPubKey& vchPubKeyIn, bool internalIn)
3936
3936
3937
3937
int CWalletTx::GetDepthInMainChain (interfaces::Chain::Lock& locked_chain) const
3938
3938
{
3939
+ assert (pwallet != nullptr );
3940
+ AssertLockHeld (pwallet->cs_wallet );
3939
3941
if (isUnconfirmed () || isAbandoned ()) return 0 ;
3940
3942
3941
- return locked_chain. getBlockDepth ( m_confirm.hashBlock ) * (isConflicted () ? -1 : 1 );
3943
+ return (pwallet-> GetLastBlockHeight () - m_confirm.block_height + 1 ) * (isConflicted () ? -1 : 1 );
3942
3944
}
3943
3945
3944
3946
int CWalletTx::GetBlocksToMaturity (interfaces::Chain::Lock& locked_chain) const
Original file line number Diff line number Diff line change @@ -499,7 +499,13 @@ class CWalletTx
499
499
* 0 : in memory pool, waiting to be included in a block
500
500
* >=1 : this many blocks deep in the main chain
501
501
*/
502
- int GetDepthInMainChain (interfaces::Chain::Lock& locked_chain) const ;
502
+ // TODO: Remove "NO_THREAD_SAFETY_ANALYSIS" and replace it with the correct
503
+ // annotation "EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)". The annotation
504
+ // "NO_THREAD_SAFETY_ANALYSIS" was temporarily added to avoid having to
505
+ // resolve the issue of member access into incomplete type CWallet. Note
506
+ // that we still have the runtime check "AssertLockHeld(pwallet->cs_wallet)"
507
+ // in place.
508
+ int GetDepthInMainChain (interfaces::Chain::Lock& locked_chain) const NO_THREAD_SAFETY_ANALYSIS;
503
509
bool IsInMainChain (interfaces::Chain::Lock& locked_chain) const { return GetDepthInMainChain (locked_chain) > 0 ; }
504
510
505
511
/* *
You can’t perform that action at this time.
0 commit comments