Skip to content

Commit

Permalink
Update sendtoaddress documention. Added missing lock. (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeIsTheKey authored Aug 2, 2024
1 parent 3062a74 commit ad2be27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,11 @@ UniValue sendtoaddress(const JSONRPCRequest &request) {
RPCResult::Type::STR_HEX, "txid", "The transaction id."
},
RPCExamples{
HelpExampleCli("sendtoaddress", "\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1")
+ HelpExampleCli("sendtoaddress",
"\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 '{\"future_maturity\":100, \"future_locktime\":10000}'")
+ HelpExampleCli("sendtoaddress",
"\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 [] \"donation\" \"seans outpost\"")
+ HelpExampleCli("sendtoaddress", "\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 \"\" \"\" true")
+ HelpExampleRpc("sendtoaddress",
"\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", [], 0.1, \"donation\", \"seans outpost\"")
HelpExampleCli("sendtoaddress", "\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1")
+ HelpExampleCli("sendtoaddress", "\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 '{\"future_maturity\":100, \"future_locktime\":10000}'")
+ HelpExampleCli("sendtoaddress", "\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 [] \"donation\" \"seans outpost\"")
+ HelpExampleCli("sendtoaddress", "\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" 0.1 [] \"\" \"\" true")
+ HelpExampleRpc("sendtoaddress", "\"RwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", 0.1, [], \"donation\", \"seans outpost\"")
},
}.Check(request);

Expand Down Expand Up @@ -405,7 +402,7 @@ UniValue sendtoaddress(const JSONRPCRequest &request) {
hasFuture = true;
fpp.maturity = request.params[nextParamsIndex]["future_maturity"].get_int();
fpp.locktime = request.params[nextParamsIndex]["future_locktime"].get_int();
fpp.futureRecScript = GetScriptForDestination(dest);
fpp.futureRecScript = GetScriptForDestination(dest);
}
}
nextParamsIndex++;
Expand All @@ -415,7 +412,7 @@ UniValue sendtoaddress(const JSONRPCRequest &request) {
nextParamsIndex++;
if (!request.params[nextParamsIndex].isNull() && !request.params[nextParamsIndex].get_str().empty()){
mapValue["to"] = request.params[nextParamsIndex].get_str();
}
}
nextParamsIndex++;
bool fSubtractFeeFromAmount = false;
if (!request.params[nextParamsIndex].isNull()) {
Expand Down
1 change: 1 addition & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,7 @@ bool CWalletTx::isFutureSpendable(unsigned int outputIndex) const {

CFutureTx futureTx;
if (GetTxPayload(tx->vExtraPayload, futureTx)) {
LOCK(cs_main);
int maturity = GetDepthInMainChain();
int64_t adjustCurrentTime = GetAdjustedTime();
uint32_t confirmedTime = GetConfirmationTime();
Expand Down

0 comments on commit ad2be27

Please sign in to comment.