@@ -1895,6 +1895,7 @@ UniValue getreceivedbyaddress(const JSONRPCRequest& request)
18951895 pwalletMain->BlockUntilSyncedToCurrentChain ();
18961896
18971897 LOCK2 (cs_main, pwalletMain->cs_wallet );
1898+ int nBlockHeight = chainActive.Height ();
18981899
18991900 // pivx address
19001901 CTxDestination address = DecodeDestination (request.params [0 ].get_str ());
@@ -1913,7 +1914,7 @@ UniValue getreceivedbyaddress(const JSONRPCRequest& request)
19131914 CAmount nAmount = 0 ;
19141915 for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet .begin (); it != pwalletMain->mapWallet .end (); ++it) {
19151916 const CWalletTx& wtx = (*it).second ;
1916- if (wtx.IsCoinBase () || !IsFinalTx (wtx.tx ))
1917+ if (wtx.IsCoinBase () || !IsFinalTx (wtx.tx , nBlockHeight ))
19171918 continue ;
19181919
19191920 for (const CTxOut& txout : wtx.tx ->vout )
@@ -1955,6 +1956,7 @@ UniValue getreceivedbylabel(const JSONRPCRequest& request)
19551956 pwalletMain->BlockUntilSyncedToCurrentChain ();
19561957
19571958 LOCK2 (cs_main, pwalletMain->cs_wallet );
1959+ int nBlockHeight = chainActive.Height ();
19581960
19591961 // Minimum confirmations
19601962 int nMinDepth = 1 ;
@@ -1969,7 +1971,7 @@ UniValue getreceivedbylabel(const JSONRPCRequest& request)
19691971 CAmount nAmount = 0 ;
19701972 for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet .begin (); it != pwalletMain->mapWallet .end (); ++it) {
19711973 const CWalletTx& wtx = (*it).second ;
1972- if (wtx.IsCoinBase () || !IsFinalTx (wtx.tx ))
1974+ if (wtx.IsCoinBase () || !IsFinalTx (wtx.tx , nBlockHeight ))
19731975 continue ;
19741976
19751977 for (const CTxOut& txout : wtx.tx ->vout ) {
@@ -2302,7 +2304,7 @@ struct tallyitem {
23022304 }
23032305};
23042306
2305- UniValue ListReceived (const UniValue& params, bool by_label)
2307+ UniValue ListReceived (const UniValue& params, bool by_label, int nBlockHeight )
23062308{
23072309 // Minimum confirmations
23082310 int nMinDepth = 1 ;
@@ -2335,7 +2337,7 @@ UniValue ListReceived(const UniValue& params, bool by_label)
23352337 for (std::map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet .begin (); it != pwalletMain->mapWallet .end (); ++it) {
23362338 const CWalletTx& wtx = (*it).second ;
23372339
2338- if (wtx.IsCoinBase () || !IsFinalTx (wtx.tx ))
2340+ if (wtx.IsCoinBase () || !IsFinalTx (wtx.tx , nBlockHeight ))
23392341 continue ;
23402342
23412343 int nDepth = wtx.GetDepthInMainChain ();
@@ -2477,8 +2479,8 @@ UniValue listreceivedbyaddress(const JSONRPCRequest& request)
24772479 pwalletMain->BlockUntilSyncedToCurrentChain ();
24782480
24792481 LOCK2 (cs_main, pwalletMain->cs_wallet );
2480-
2481- return ListReceived (request.params , false );
2482+ int nBlockHeight = chainActive. Height ();
2483+ return ListReceived (request.params , false , nBlockHeight );
24822484}
24832485
24842486UniValue listreceivedbyshieldaddress (const JSONRPCRequest& request)
@@ -2613,8 +2615,8 @@ UniValue listreceivedbylabel(const JSONRPCRequest& request)
26132615 pwalletMain->BlockUntilSyncedToCurrentChain ();
26142616
26152617 LOCK2 (cs_main, pwalletMain->cs_wallet );
2616-
2617- return ListReceived (request.params , true );
2618+ int nBlockHeight = chainActive. Height ();
2619+ return ListReceived (request.params , true , nBlockHeight );
26182620}
26192621
26202622UniValue listcoldutxos (const JSONRPCRequest& request)
0 commit comments