bitcoin/src/wallet
fanquake 01ebaa05a4
Merge #16572: wallet: Fix Char as Bool in Wallet
2dbfb37b40 Fix Char as Bool in interfaces (Jeremy Rubin)

Pull request description:

  In a few places in src/wallet/wallet.h, we use a char when semantically we want a bool.

  This is kind of an issue because it means we can unserialize the same transaction with different fFromMe flags (as differing chars) and evaluate the following section in wallet/wallet.cpp
  ```c++
          if (wtxIn.fFromMe && wtxIn.fFromMe != wtx.fFromMe)
           {
               wtx.fFromMe = wtxIn.fFromMe;
               fUpdated = true;
           }
  ```
  incorrectly (triggering an fUpdated where both fFromMe values represent true, via different chars).

  I don't think this is a vulnerability, but it's just a little messy and unsemantic, and could lead to issues with stored wtxIns not being findable in a map by their hash.

  The serialize/unserialize code for bool internally uses a char, so it should be safe to make this substitution.

  NOTE: Technically, this is a behavior change -- I haven't checked too closely that nowhere is depending on storing information in this char. Theoretically, this could break something because after this change a tx unserialized with such a char would preserve it's value, but now it is converted to a ~true~ canonical bool.

ACKs for top commit:
  achow101:
    Code review ACK 2dbfb37b40
  meshcollider:
    Code review ACK 2dbfb37b40

Tree-SHA512: 8c0dc9cf672aa2276c694facbf50febe7456eaa8bf2bd2504f81a61052264b8b30cdb5326e1936893adc3d33504667aee3c7e207a194c71d87b3e7b5fe199c9d
2019-08-21 15:25:59 +08:00
..
test Merge #16277: [Tests] Suppress output in test_bitcoin for expected errors 2019-08-01 15:17:10 +02:00
coincontrol.cpp extract min & max depth onto coin control 2019-07-22 15:23:21 -04:00
coincontrol.h extract min & max depth onto coin control 2019-07-22 15:23:21 -04:00
coinselection.cpp Introduce a Shuffle for FastRandomContext and use it in wallet and coinselection 2018-12-12 14:22:12 -08:00
coinselection.h amount: Move CAmount CENT to unit test header 2018-09-17 14:34:56 -04:00
crypter.cpp Remove CCryptoKeyStore and move all of it's functionality into CWallet 2019-07-09 16:20:18 -04:00
crypter.h Remove CCryptoKeyStore and move all of it's functionality into CWallet 2019-07-09 16:20:18 -04:00
db.cpp Merge #15588: Log the actual wallet file version and no longer publicly expose the "version" record 2019-07-27 22:45:31 +12:00
db.h Merge #15588: Log the actual wallet file version and no longer publicly expose the "version" record 2019-07-27 22:45:31 +12:00
feebumper.cpp Restrict lifetime of ReserveDestination to CWallet::CreateTransaction 2019-07-10 11:38:37 -04:00
feebumper.h scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
fees.cpp [wallet] abort when attempting to fund a transaction above maxtxfee 2019-06-28 22:44:38 -04:00
fees.h Remove uses of fee globals in wallet code 2019-02-22 15:43:02 -04:00
init.cpp Use ArgsManager::NETWORK_ONLY flag 2019-07-27 22:51:58 +03:00
ismine.cpp Move various SigningProviders to signingprovider.{cpp,h} 2019-07-09 16:20:18 -04:00
ismine.h Change ismine to take a CWallet instead of CKeyStore 2019-06-19 18:06:30 -04:00
load.cpp scripted-diff: Make translation bilingual 2019-07-24 16:33:20 +03:00
load.h scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
psbtwallet.cpp Merge #15427: Add support for descriptors to utxoupdatepsbt 2019-07-02 16:53:22 +02:00
psbtwallet.h Remove unused TransactionError constants 2019-02-14 10:32:02 -05:00
rpcdump.cpp Give more errors for specific failure conditions 2019-08-16 19:34:01 -04:00
rpcwallet.cpp Merge #16383: rpcwallet: default include_watchonly to true for watchonly wallets 2019-08-16 11:55:35 +08:00
rpcwallet.h Merge #15870: wallet: Only fail rescan when blocks have actually been pruned 2019-05-16 11:18:27 -04:00
wallet.cpp [wallet] Restore confirmed/conflicted tx check in SubmitMemoryPoolAndRelay() 2019-08-09 11:07:30 -04:00
wallet.h Merge #16572: wallet: Fix Char as Bool in Wallet 2019-08-21 15:25:59 +08:00
walletdb.cpp wallet: Drop unused OldKey 2019-07-31 18:35:46 +01:00
walletdb.h Add setting as known type 2019-07-30 06:36:34 +01:00
wallettool.cpp scripted-diff: Replace fprintf with tfm::format 2019-06-13 10:32:52 -04:00
wallettool.h Move ismine to wallet module 2019-06-19 18:06:30 -04:00
walletutil.cpp Merge #15870: wallet: Only fail rescan when blocks have actually been pruned 2019-05-16 11:18:27 -04:00
walletutil.h wallet: Add WalletLocation utility class 2018-10-25 11:53:17 +01:00