aboutsummaryrefslogtreecommitdiff
path: root/src/qt/optionsmodel.h
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-11-12 12:14:52 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-01-08 17:21:40 +0200
commit2bede28cd9ec638d8bb32c187ccf12d89345218e (patch)
tree9562a0b91bd66adae244f9d7222a1e7d5e995d40 /src/qt/optionsmodel.h
parente35e4b2ba052c9a533626286026dbe0a2d546c5b (diff)
downloadbitcoin-2bede28cd9ec638d8bb32c187ccf12d89345218e.tar.xz
util: Add PruneGBtoMiB() function
This commit does not change behavior.
Diffstat (limited to 'src/qt/optionsmodel.h')
-rw-r--r--src/qt/optionsmodel.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
index 9751deadc4..81ab0008e4 100644
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -22,6 +22,11 @@ static constexpr unsigned short DEFAULT_GUI_PROXY_PORT = 9050;
*/
static inline int PruneMiBtoGB(int64_t mib) { return (mib * 1024 * 1024 + GB_BYTES - 1) / GB_BYTES; }
+/**
+ * Convert displayed prune target GB to configured MiB. Round down so roundtrip GB -> MiB -> GB conversion is stable.
+ */
+static inline int64_t PruneGBtoMiB(int gb) { return gb * GB_BYTES / 1024 / 1024; }
+
/** Interface from Qt to configuration data structure for Bitcoin client.
To Qt, the options are presented as a list with the different options
laid out vertically.