0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-06 10:18:44 -05:00
bitcoin-bitcoin-core/src/util
MarcoFalke 0dc6218c79
Merge #18270: util: Fail to parse whitespace-only strings in ParseMoney(...) (instead of parsing as zero)
100213c5c2 util: Fail to parse space-only strings in ParseMoney(...) (instead of parsing as zero) (practicalswift)

Pull request description:

  Fail to parse whitespace-only strings in `ParseMoney(...)` (instead of parsing as `0`).

  This is a follow-up to #18225 ("util: Fail to parse empty string in `ParseMoney`") which made `ParseMoney("")` fail instead of parsing as `0`.

  Context: https://github.com/bitcoin/bitcoin/pull/18225#issuecomment-592994765

  Current non-test call sites:

  ```
  $ git grep ParseMoney ":(exclude)src/test/"
  src/bitcoin-tx.cpp:    if (!ParseMoney(strValue, value))
  src/init.cpp:        if (!ParseMoney(gArgs.GetArg("-incrementalrelayfee", ""), n))
  src/init.cpp:        if (!ParseMoney(gArgs.GetArg("-minrelaytxfee", ""), n)) {
  src/init.cpp:        if (!ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n))
  src/init.cpp:        if (!ParseMoney(gArgs.GetArg("-dustrelayfee", ""), n))
  src/miner.cpp:    if (gArgs.IsArgSet("-blockmintxfee") && ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n)) {
  src/util/moneystr.cpp:bool ParseMoney(const std::string& str, CAmount& nRet)
  src/util/moneystr.h:NODISCARD bool ParseMoney(const std::string& str, CAmount& nRet);
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-mintxfee", ""), n) || 0 == n) {
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) {
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-discardfee", ""), nFeePerK)) {
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-paytxfee", ""), nFeePerK)) {
  src/wallet/wallet.cpp:        if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee)) {
  ```

ACKs for top commit:
  Empact:
    ACK 100213c5c2
  sipa:
    ACK 100213c5c2
  theStack:
    ACK 100213c5c2

Tree-SHA512: cadfb1ac8276cf54736c3444705f2650e7a08023673aedc729fabe751ae80f6c490fc0945ee38dbfd02c95e4d9853d1e4c84f5d3c310f44eaf3585afec8a4c22
2020-03-26 20:25:55 -04:00
..
asmap.cpp Make asmap Interpret tolerant of malicious map data 2020-01-31 14:51:37 -08:00
asmap.h Add asmap utility which queries a mapping 2019-12-18 14:27:03 -05:00
bip32.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
bip32.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
bytevectorhash.cpp blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
bytevectorhash.h blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
check.h util: Add CHECK_NONFATAL and use it in src/rpc 2019-10-18 17:19:36 -04:00
error.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
error.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
fees.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
fees.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
macros.h refactor: consolidate PASTE macros 2019-09-25 10:56:00 -04:00
memory.h scripted-diff: Move util files to separate directory. 2018-11-04 22:46:07 -08:00
message.cpp Move direct calls to MessageSign into new SignMessage functions in CWallet and ScriptPubKeyMan 2020-03-09 11:16:20 -04:00
message.h Move direct calls to MessageSign into new SignMessage functions in CWallet and ScriptPubKeyMan 2020-03-09 11:16:20 -04:00
moneystr.cpp util: Fail to parse space-only strings in ParseMoney(...) (instead of parsing as zero) 2020-03-12 14:15:10 +00:00
moneystr.h util: Remove unused ParseMoney that takes a c_str 2020-02-29 00:25:37 +07:00
rbf.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
rbf.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
settings.cpp refactor: Remove null setting check in GetSetting() 2019-11-13 15:23:06 -05:00
settings.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
spanparsing.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
spanparsing.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
strencodings.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
strencodings.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
string.cpp util: Add Join helper to join a list of strings 2019-08-20 16:51:41 -04:00
string.h Replace std::to_string with locale-independent alternative 2020-03-14 12:23:01 -07:00
system.cpp Merge #13339: wallet: Replace %w by wallet name in -walletnotify script 2020-02-17 11:59:23 +01:00
system.h Merge #13339: wallet: Replace %w by wallet name in -walletnotify script 2020-02-17 11:59:23 +01:00
threadnames.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
threadnames.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
time.cpp Merge #16117: util: Replace boost sleep with std sleep 2020-03-06 15:41:00 +08:00
time.h util: Remove unused MilliSleep 2020-02-21 10:06:27 -08:00
translation.h MOVEONLY: Move key handling code out of wallet to keyman file 2019-10-25 19:20:24 -04:00
url.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
url.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
vector.h Add some general std::vector utility functions 2019-10-16 08:56:57 -07:00