bitcoin/src/wallet
MarcoFalke 808c84f89d
Merge #11483: Fix importmulti bug when importing an already imported key
a44a21517 Fix importmulti bug when importing an already imported key (Pedro Branco)

Pull request description:

  This PR fixes a bug in `importmulti` RPC call where it returns an invalid response when importing an already imported key.

  Before:
  ```sh
  ❯ bitcoin-cli -regtest importmulti '[{ "keys": ["cNcMUunXhVK1dXJ5riixtpYSxPXZnUAMGS4vpzwChdKmYY3Rz99v"], "scriptPubKey": { "address": "n4YZAf4WE2XF3t4BfeYS2nHAhb8CVx91BR" }, "timestamp": 1507655239 }]'
  [{ "success": true }]

  ❯ bitcoin-cli -regtest importmulti '[{ "keys": ["cNcMUunXhVK1dXJ5riixtpYSxPXZnUAMGS4vpzwChdKmYY3Rz99v"], "scriptPubKey": { "address": "n4YZAf4WE2XF3t4BfeYS2nHAhb8CVx91BR" }, "timestamp": 1507655239 }]' '{ "rescan": false }'
  [ false ]

  ❯ bitcoin-cli -regtest importmulti '[{ "keys": ["cNcMUunXhVK1dXJ5riixtpYSxPXZnUAMGS4vpzwChdKmYY3Rz99v"], "scriptPubKey": { "address": "n4YZAf4WE2XF3t4BfeYS2nHAhb8CVx91BR" }, "timestamp": 1507655239 }]' '{ "rescan": true }'
  error code: -1
  error message:
  JSON value is not a boolean as expected
  ```

  After this fix:
  ```sh
  ❯ bitcoin-cli -rpcuser=u -rpcpassword=p -regtest importmulti '[{ "keys": ["cNcMUunXhVK1dXJ5riixtpYSxPXZnUAMGS4vpzwChdKmYY3Rz99v"], "scriptPubKey": { "address": "n4YZAf4WE2XF3t4BfeYS2nHAhb8CVx91BR" }, "timestamp": 1507655139 }]'
  [{ "success": true }]

  ❯ bitcoin-cli -rpcuser=u -rpcpassword=p -regtest importmulti '[{ "keys": ["cNcMUunXhVK1dXJ5riixtpYSxPXZnUAMGS4vpzwChdKmYY3Rz99v"], "scriptPubKey": { "address": "n4YZAf4WE2XF3t4BfeYS2nHAhb8CVx91BR" }, "timestamp": 1507655139 }]'
  [{ "success": false, "error": { "code": -4, "message": "The wallet already contains the private key for this address or script" } }]
  ```

Tree-SHA512: 4acebdfb7d0ebd7cd48e943b93ed1cec072db1ace5c42b3f5cc225603764b6e804e4b823b0710965826aafc2f0c615c53d5aefcfdb9bc9c379f5221b798a318c
2017-10-17 21:40:54 +02:00
..
test Merge #7061: [Wallet] Add RPC call "rescanblockchain <startheight> <stopheight>" 2017-10-13 15:23:22 -07:00
coincontrol.h Make QT fee displays use GetMinimumFee instead of estimateSmartFee 2017-07-14 23:41:37 -04:00
crypter.cpp Changing &vec[0] to vec.data(), what 9804 missed 2017-09-08 10:36:26 +12:00
crypter.h Merge #11107: Fix races in AppInitMain and others with lock and atomic bools 2017-10-05 15:03:36 +02:00
db.cpp Merge #10845: Remove unreachable code 2017-09-06 21:44:18 +02:00
db.h Refactor: Modernize disallowed copy constructors/assignment 2017-09-16 13:06:05 +03:00
feebumper.cpp Merge #10976: [MOVEONLY] Move some static functions out of wallet.h/cpp 2017-08-25 21:30:42 +02:00
feebumper.h Refactor to use CoinControl in GetMinimumFee and FeeBumper 2017-07-14 23:10:58 -04:00
fees.cpp MOVEONLY: Fee functions wallet/wallet.cpp -> wallet/fees.cpp 2017-08-14 11:19:38 -04:00
fees.h Move some static functions out of wallet.h/cpp 2017-08-14 11:19:38 -04:00
init.cpp Merge #11250: Bump wallet version to 159900 and remove the usehd option 2017-09-08 02:28:12 +02:00
init.h [trivial] fixup comment for VerifyWallets() 2017-09-07 16:22:11 -07:00
rpcdump.cpp Fix importmulti bug when importing an already imported key 2017-10-11 17:20:42 +01:00
rpcwallet.cpp Add missing comma from rescanblockchain 2017-10-14 12:34:04 +13:00
rpcwallet.h [wallet] Add RegisterWalletRPC() function to wallet/init.cpp 2017-09-07 16:21:26 -07:00
wallet.cpp Merge #7061: [Wallet] Add RPC call "rescanblockchain <startheight> <stopheight>" 2017-10-13 15:23:22 -07:00
wallet.h Merge #7061: [Wallet] Add RPC call "rescanblockchain <startheight> <stopheight>" 2017-10-13 15:23:22 -07:00
walletdb.cpp Fix parameter name typo in ErasePurpose walletdb method. 2017-09-26 18:02:09 -04:00
walletdb.h Refactor: Modernize disallowed copy constructors/assignment 2017-09-16 13:06:05 +03:00