aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-10-18 20:40:09 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-10-18 20:55:35 +0200
commit1646f9c7603610a55b36ee1f1f057ecabaf3e6de (patch)
tree0324a1c76e3eb18fd218e378e2d0bc2686cc4955 /src/rpc
parent51bad9195eb435200626beccbaf6b60774a4a894 (diff)
parent20cdc2b36c40221a0eec942a1fbdf38ca7c4e005 (diff)
downloadbitcoin-1646f9c7603610a55b36ee1f1f057ecabaf3e6de.tar.xz
Merge #11447: 0.15.1: Backports
20cdc2b Fix importmulti bug when importing an already imported key (Pedro Branco) 405e069 Update importprivkey named args documentation (Dusty Williams) c94527a [Docs] Update Windows build instructions for using WSL and Ubuntu 17.04 (fanquake) 27e861a net: Improve and document SOCKS code (Wladimir J. van der Laan) dea3b87 Add new step to clean $PATH var by removing /mnt specific Window's %PATH% paths that cause issues with the make system (Donal OConnor) a43be5b rpc: Prevent `dumpwallet` from overwriting files (Wladimir J. van der Laan) b6c0209 Fix validationinterface build on super old boost/clang (Matt Corallo) 6a62c74 qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan) 0fe2a9a when clearing addrman clear mapInfo and mapAddr (Gregory Sanders) 6b4d9f2 wallet: update stored witness in AddToWallet (Suhas Daftuar) 62d18cd doc: Prepare release notes for 0.15.1 (MarcoFalke) 8b61aee Put back inadvertently removed copyright notices (Paul Berg) 75997c3 Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds (Matt Corallo) 8d13b42 Replace save|restoreWindowGeometry with Qt functions (MeshCollider) 6642558 [Qt] Add delay before filtering transactions Fixes 3141 (Lucas Betschart) 19d63e8 Remove custom fee radio group (Andrew Chow) b1a6c94 rpc: make estimatesmartfee argument naming consistent with documentation (Wladimir J. van der Laan) 921542e rpc: update cli for estimatefee argument rename (Wladimir J. van der Laan) 2e31b1d Fix division by zero in time remaining (MeshCollider) 47c02a8 qt: Use IsMine to validate custom change address (Chris Moore) 7310f1f [Qt] Fix display of package name on 'open config file' tooltip (Daniel Edgecumbe) 2cb720a Acquire cs_main lock before cs_wallet during wallet initialization (Russell Yanofsky) b278a43 rpc: Write authcookie atomically (Wladimir J. van der Laan) 50bd3f6 Avoid returning a BIP9Stats object with uninitialized values (practicalswift) 9e8aae3 [wallet] Close DB on error. (Karl-Johan Alm) Pull request description: This mostly backports various commits that fix(ed) bugs and issues. However, it also includes two patches for qt that only fix minor issues, as well as some doc patches. Tree-SHA512: 5165e309faf6b4395fdf2f6662ccc0d58306971f3769e675504f17b2055efe29b2919f22d0dbf78c4c2dc7fd5c9d08a2c53345615e4a1df73914526687c9d571
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/client.cpp4
-rw-r--r--src/rpc/protocol.cpp21
-rw-r--r--src/rpc/protocol.h2
3 files changed, 18 insertions, 9 deletions
diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp
index 4179453782..406ad2f6ec 100644
--- a/src/rpc/client.cpp
+++ b/src/rpc/client.cpp
@@ -115,8 +115,8 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "keypoolrefill", 0, "newsize" },
{ "getrawmempool", 0, "verbose" },
{ "estimatefee", 0, "nblocks" },
- { "estimatesmartfee", 0, "nblocks" },
- { "estimaterawfee", 0, "nblocks" },
+ { "estimatesmartfee", 0, "conf_target" },
+ { "estimaterawfee", 0, "conf_target" },
{ "estimaterawfee", 1, "threshold" },
{ "prioritisetransaction", 1, "dummy" },
{ "prioritisetransaction", 2, "fee_delta" },
diff --git a/src/rpc/protocol.cpp b/src/rpc/protocol.cpp
index db0626b5e1..dc6bcec382 100644
--- a/src/rpc/protocol.cpp
+++ b/src/rpc/protocol.cpp
@@ -66,9 +66,14 @@ static const std::string COOKIEAUTH_USER = "__cookie__";
/** Default name for auth cookie file */
static const std::string COOKIEAUTH_FILE = ".cookie";
-fs::path GetAuthCookieFile()
+/** Get name of RPC authentication cookie file */
+static fs::path GetAuthCookieFile(bool temp=false)
{
- fs::path path(gArgs.GetArg("-rpccookiefile", COOKIEAUTH_FILE));
+ std::string arg = gArgs.GetArg("-rpccookiefile", COOKIEAUTH_FILE);
+ if (temp) {
+ arg += ".tmp";
+ }
+ fs::path path(arg);
if (!path.is_complete()) path = GetDataDir() / path;
return path;
}
@@ -84,14 +89,20 @@ bool GenerateAuthCookie(std::string *cookie_out)
* these are set to 077 in init.cpp unless overridden with -sysperms.
*/
std::ofstream file;
- fs::path filepath = GetAuthCookieFile();
- file.open(filepath.string().c_str());
+ fs::path filepath_tmp = GetAuthCookieFile(true);
+ file.open(filepath_tmp.string().c_str());
if (!file.is_open()) {
- LogPrintf("Unable to open cookie authentication file %s for writing\n", filepath.string());
+ LogPrintf("Unable to open cookie authentication file %s for writing\n", filepath_tmp.string());
return false;
}
file << cookie;
file.close();
+
+ fs::path filepath = GetAuthCookieFile(false);
+ if (!RenameOver(filepath_tmp, filepath)) {
+ LogPrintf("Unable to rename cookie authentication file %s to %s\n", filepath_tmp.string(), filepath.string());
+ return false;
+ }
LogPrintf("Generated RPC authentication cookie %s\n", filepath.string());
if (cookie_out)
diff --git a/src/rpc/protocol.h b/src/rpc/protocol.h
index 4bd4702d62..5c9c64f67d 100644
--- a/src/rpc/protocol.h
+++ b/src/rpc/protocol.h
@@ -91,8 +91,6 @@ UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const Un
std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
UniValue JSONRPCError(int code, const std::string& message);
-/** Get name of RPC authentication cookie file */
-fs::path GetAuthCookieFile();
/** Generate a new RPC authentication cookie and write it to disk */
bool GenerateAuthCookie(std::string *cookie_out);
/** Read the RPC authentication cookie from disk */