@@ -455,6 +455,11 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
455
455
);
456
456
457
457
ObserveSafeMode ();
458
+
459
+ // Make sure the results are valid at least up to the most recent block
460
+ // the user could have gotten from another RPC command prior to now
461
+ pwallet->BlockUntilSyncedToCurrentChain ();
462
+
458
463
LOCK2 (cs_main, pwallet->cs_wallet );
459
464
460
465
CTxDestination dest = DecodeDestination (request.params [0 ].get_str ());
@@ -533,6 +538,11 @@ UniValue listaddressgroupings(const JSONRPCRequest& request)
533
538
);
534
539
535
540
ObserveSafeMode ();
541
+
542
+ // Make sure the results are valid at least up to the most recent block
543
+ // the user could have gotten from another RPC command prior to now
544
+ pwallet->BlockUntilSyncedToCurrentChain ();
545
+
536
546
LOCK2 (cs_main, pwallet->cs_wallet );
537
547
538
548
UniValue jsonGroupings (UniValue::VARR);
@@ -645,6 +655,11 @@ UniValue getreceivedbyaddress(const JSONRPCRequest& request)
645
655
);
646
656
647
657
ObserveSafeMode ();
658
+
659
+ // Make sure the results are valid at least up to the most recent block
660
+ // the user could have gotten from another RPC command prior to now
661
+ pwallet->BlockUntilSyncedToCurrentChain ();
662
+
648
663
LOCK2 (cs_main, pwallet->cs_wallet );
649
664
650
665
// Bitcoin address
@@ -707,6 +722,11 @@ UniValue getreceivedbyaccount(const JSONRPCRequest& request)
707
722
);
708
723
709
724
ObserveSafeMode ();
725
+
726
+ // Make sure the results are valid at least up to the most recent block
727
+ // the user could have gotten from another RPC command prior to now
728
+ pwallet->BlockUntilSyncedToCurrentChain ();
729
+
710
730
LOCK2 (cs_main, pwallet->cs_wallet );
711
731
712
732
// Minimum confirmations
@@ -780,6 +800,11 @@ UniValue getbalance(const JSONRPCRequest& request)
780
800
);
781
801
782
802
ObserveSafeMode ();
803
+
804
+ // Make sure the results are valid at least up to the most recent block
805
+ // the user could have gotten from another RPC command prior to now
806
+ pwallet->BlockUntilSyncedToCurrentChain ();
807
+
783
808
LOCK2 (cs_main, pwallet->cs_wallet );
784
809
785
810
const UniValue& account_value = request.params [0 ];
@@ -825,6 +850,11 @@ UniValue getunconfirmedbalance(const JSONRPCRequest &request)
825
850
" Returns the server's total unconfirmed balance\n " );
826
851
827
852
ObserveSafeMode ();
853
+
854
+ // Make sure the results are valid at least up to the most recent block
855
+ // the user could have gotten from another RPC command prior to now
856
+ pwallet->BlockUntilSyncedToCurrentChain ();
857
+
828
858
LOCK2 (cs_main, pwallet->cs_wallet );
829
859
830
860
return ValueFromAmount (pwallet->GetUnconfirmedBalance ());
@@ -919,6 +949,11 @@ UniValue sendfrom(const JSONRPCRequest& request)
919
949
);
920
950
921
951
ObserveSafeMode ();
952
+
953
+ // Make sure the results are valid at least up to the most recent block
954
+ // the user could have gotten from another RPC command prior to now
955
+ pwallet->BlockUntilSyncedToCurrentChain ();
956
+
922
957
LOCK2 (cs_main, pwallet->cs_wallet );
923
958
924
959
std::string strAccount = AccountFromValue (request.params [0 ]);
@@ -1004,6 +1039,11 @@ UniValue sendmany(const JSONRPCRequest& request)
1004
1039
);
1005
1040
1006
1041
ObserveSafeMode ();
1042
+
1043
+ // Make sure the results are valid at least up to the most recent block
1044
+ // the user could have gotten from another RPC command prior to now
1045
+ pwallet->BlockUntilSyncedToCurrentChain ();
1046
+
1007
1047
LOCK2 (cs_main, pwallet->cs_wallet );
1008
1048
1009
1049
if (pwallet->GetBroadcastTransactions () && !g_connman) {
@@ -1455,6 +1495,11 @@ UniValue listreceivedbyaddress(const JSONRPCRequest& request)
1455
1495
);
1456
1496
1457
1497
ObserveSafeMode ();
1498
+
1499
+ // Make sure the results are valid at least up to the most recent block
1500
+ // the user could have gotten from another RPC command prior to now
1501
+ pwallet->BlockUntilSyncedToCurrentChain ();
1502
+
1458
1503
LOCK2 (cs_main, pwallet->cs_wallet );
1459
1504
1460
1505
return ListReceived (pwallet, request.params , false );
@@ -1495,6 +1540,11 @@ UniValue listreceivedbyaccount(const JSONRPCRequest& request)
1495
1540
);
1496
1541
1497
1542
ObserveSafeMode ();
1543
+
1544
+ // Make sure the results are valid at least up to the most recent block
1545
+ // the user could have gotten from another RPC command prior to now
1546
+ pwallet->BlockUntilSyncedToCurrentChain ();
1547
+
1498
1548
LOCK2 (cs_main, pwallet->cs_wallet );
1499
1549
1500
1550
return ListReceived (pwallet, request.params , true );
@@ -1683,6 +1733,11 @@ UniValue listtransactions(const JSONRPCRequest& request)
1683
1733
);
1684
1734
1685
1735
ObserveSafeMode ();
1736
+
1737
+ // Make sure the results are valid at least up to the most recent block
1738
+ // the user could have gotten from another RPC command prior to now
1739
+ pwallet->BlockUntilSyncedToCurrentChain ();
1740
+
1686
1741
LOCK2 (cs_main, pwallet->cs_wallet );
1687
1742
1688
1743
std::string strAccount = " *" ;
@@ -1777,6 +1832,11 @@ UniValue listaccounts(const JSONRPCRequest& request)
1777
1832
);
1778
1833
1779
1834
ObserveSafeMode ();
1835
+
1836
+ // Make sure the results are valid at least up to the most recent block
1837
+ // the user could have gotten from another RPC command prior to now
1838
+ pwallet->BlockUntilSyncedToCurrentChain ();
1839
+
1780
1840
LOCK2 (cs_main, pwallet->cs_wallet );
1781
1841
1782
1842
int nMinDepth = 1 ;
@@ -1886,6 +1946,11 @@ UniValue listsinceblock(const JSONRPCRequest& request)
1886
1946
);
1887
1947
1888
1948
ObserveSafeMode ();
1949
+
1950
+ // Make sure the results are valid at least up to the most recent block
1951
+ // the user could have gotten from another RPC command prior to now
1952
+ pwallet->BlockUntilSyncedToCurrentChain ();
1953
+
1889
1954
LOCK2 (cs_main, pwallet->cs_wallet );
1890
1955
1891
1956
const CBlockIndex* pindex = nullptr ; // Block index of the specified block or the common ancestor, if the block provided was in a deactivated chain.
@@ -2018,6 +2083,11 @@ UniValue gettransaction(const JSONRPCRequest& request)
2018
2083
);
2019
2084
2020
2085
ObserveSafeMode ();
2086
+
2087
+ // Make sure the results are valid at least up to the most recent block
2088
+ // the user could have gotten from another RPC command prior to now
2089
+ pwallet->BlockUntilSyncedToCurrentChain ();
2090
+
2021
2091
LOCK2 (cs_main, pwallet->cs_wallet );
2022
2092
2023
2093
uint256 hash;
@@ -2080,6 +2150,11 @@ UniValue abandontransaction(const JSONRPCRequest& request)
2080
2150
);
2081
2151
2082
2152
ObserveSafeMode ();
2153
+
2154
+ // Make sure the results are valid at least up to the most recent block
2155
+ // the user could have gotten from another RPC command prior to now
2156
+ pwallet->BlockUntilSyncedToCurrentChain ();
2157
+
2083
2158
LOCK2 (cs_main, pwallet->cs_wallet );
2084
2159
2085
2160
uint256 hash;
@@ -2114,6 +2189,10 @@ UniValue backupwallet(const JSONRPCRequest& request)
2114
2189
+ HelpExampleRpc (" backupwallet" , " \" backup.dat\" " )
2115
2190
);
2116
2191
2192
+ // Make sure the results are valid at least up to the most recent block
2193
+ // the user could have gotten from another RPC command prior to now
2194
+ pwallet->BlockUntilSyncedToCurrentChain ();
2195
+
2117
2196
LOCK2 (cs_main, pwallet->cs_wallet );
2118
2197
2119
2198
std::string strDest = request.params [0 ].get_str ();
@@ -2433,6 +2512,10 @@ UniValue lockunspent(const JSONRPCRequest& request)
2433
2512
+ HelpExampleRpc (" lockunspent" , " false, \" [{\\\" txid\\\" :\\\" a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\" ,\\\" vout\\\" :1}]\" " )
2434
2513
);
2435
2514
2515
+ // Make sure the results are valid at least up to the most recent block
2516
+ // the user could have gotten from another RPC command prior to now
2517
+ pwallet->BlockUntilSyncedToCurrentChain ();
2518
+
2436
2519
LOCK2 (cs_main, pwallet->cs_wallet );
2437
2520
2438
2521
RPCTypeCheckArgument (request.params [0 ], UniValue::VBOOL);
@@ -2592,6 +2675,11 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
2592
2675
);
2593
2676
2594
2677
ObserveSafeMode ();
2678
+
2679
+ // Make sure the results are valid at least up to the most recent block
2680
+ // the user could have gotten from another RPC command prior to now
2681
+ pwallet->BlockUntilSyncedToCurrentChain ();
2682
+
2595
2683
LOCK2 (cs_main, pwallet->cs_wallet );
2596
2684
2597
2685
UniValue obj (UniValue::VOBJ);
@@ -2801,6 +2889,10 @@ UniValue listunspent(const JSONRPCRequest& request)
2801
2889
nMaximumCount = options[" maximumCount" ].get_int64 ();
2802
2890
}
2803
2891
2892
+ // Make sure the results are valid at least up to the most recent block
2893
+ // the user could have gotten from another RPC command prior to now
2894
+ pwallet->BlockUntilSyncedToCurrentChain ();
2895
+
2804
2896
UniValue results (UniValue::VARR);
2805
2897
std::vector<COutput> vecOutputs;
2806
2898
assert (pwallet != nullptr );
@@ -2911,6 +3003,10 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
2911
3003
ObserveSafeMode ();
2912
3004
RPCTypeCheck (request.params , {UniValue::VSTR});
2913
3005
3006
+ // Make sure the results are valid at least up to the most recent block
3007
+ // the user could have gotten from another RPC command prior to now
3008
+ pwallet->BlockUntilSyncedToCurrentChain ();
3009
+
2914
3010
CCoinControl coinControl;
2915
3011
int changePosition = -1 ;
2916
3012
bool lockUnspents = false ;
@@ -3121,6 +3217,10 @@ UniValue bumpfee(const JSONRPCRequest& request)
3121
3217
}
3122
3218
}
3123
3219
3220
+ // Make sure the results are valid at least up to the most recent block
3221
+ // the user could have gotten from another RPC command prior to now
3222
+ pwallet->BlockUntilSyncedToCurrentChain ();
3223
+
3124
3224
LOCK2 (cs_main, pwallet->cs_wallet );
3125
3225
EnsureWalletIsUnlocked (pwallet);
3126
3226
0 commit comments