bitcoin/src/wallet
Samuel Dobson ffaac6e614
Merge #16378: The ultimate send RPC
92326d8976 [rpc] add send method (Sjors Provoost)
2c2a1445dc [rpc] add snake case aliases for transaction methods (Sjors Provoost)
1bc8d0fd59 [rpc] walletcreatefundedpsbt: allow inputs to be null (Sjors Provoost)

Pull request description:

  `walletcreatefundedpsbt` has some interesting features that `sendtoaddress` and `sendmany` don't have:
  * manual coin selection
  * outputting a PSBT (it was controversial to add this, see #18201)
  * create a transaction without adding to wallet (which leads to broadcasting, unless `-walletbroadcast=0`)

  At the same time `walletcreatefundedpsbt` can't broadcast a transaction, which is inconvenient for simple use cases.

  This PR introduces a new `send` RPC method which creates a PSBT, signs it if possible and adds it to the wallet by default. If it can't sign all inputs, it outputs a PSBT. If `add_to_wallet` is set to `false` it will return the transaction in both PSBT and hex format.

  Because it uses a PSBT internally, it will much easier to add hardware wallet support to this method (see #16546).

  For `bitcoin-cli` users, it tries to keep the simplest use case easy to use:

  ```sh
  bitcoin-cli -regtest send '{"ADDRESS": 0.1}' 1 sat/b
  ```

  This paves the way for deprecating `sendtoaddress` and `sendmany` though there's no rush. The only missing feature compared to these older methods is adding labels to a destination address.

  Depends on:
  - [x] #16377 (`[rpc] don't automatically append inputs in walletcreatefundedpsbt`)
  - [x] #11413 (`[wallet] [rpc] sendtoaddress/sendmany: Add explicit feerate option`)
  - [x] #18244 (`[rpc] have lockUnspents also lock manually selected coins`)

ACKs for top commit:
  meshcollider:
    Light re-utACK 92326d8976
  achow101:
    ACK 92326d8976 Reviewed code and test, ran tests.
  kallewoof:
    utACK 92326d8976

Tree-SHA512: 7552ef1b193d4c06e381c44932fdb0d54f64383e4c7d6b988f49d059c7d4bba45ce6aa7813e03df86360ad9dad6f3010eb76ee7da480551742d5fd98c2251c0f
2020-09-15 14:49:08 +12:00
..
test refactor: Pass wallet database into CWallet::Create 2020-09-03 12:24:32 -04:00
bdb.cpp refactor: Pass wallet database into CWallet::Create 2020-09-03 12:24:32 -04:00
bdb.h refactor: Pass wallet database into CWallet::Create 2020-09-03 12:24:32 -04:00
coincontrol.cpp [rpc] walletcreatefundedpsbt: don't automatically append inputs 2020-03-12 13:07:17 +01:00
coincontrol.h [rpc] walletcreatefundedpsbt: don't automatically append inputs 2020-03-12 13:07:17 +01:00
coinselection.cpp Refactor OutputGroups to handle effective values, fees, and filtering 2020-08-11 14:25:02 -04:00
coinselection.h Refactor OutputGroups to handle effective values, fees, and filtering 2020-08-11 14:25:02 -04:00
context.cpp Remove g_rpc_chain global 2020-05-28 02:13:19 -04:00
context.h wallet: Pass unused args to StartWallets 2020-07-09 13:07:37 +02:00
crypter.cpp Fix occurences of c_str() used with size() to data() 2019-10-28 13:41:45 +01:00
crypter.h Convert wallet to new serialization 2020-05-24 10:34:52 -07:00
db.cpp refactor: Pass wallet database into CWallet::Create 2020-09-03 12:24:32 -04:00
db.h bugfix: make LoadWallet assigns status always 2020-09-10 00:47:31 +09:00
feebumper.cpp wallet: Remove trailing whitespace from potential translation strings 2020-05-01 07:41:32 -04:00
feebumper.h wallet: Avoid translating RPC errors when creating txs 2020-05-01 07:39:06 -04:00
fees.cpp Remove unused includes 2019-10-15 22:56:43 +00:00
fees.h Remove uses of fee globals in wallet code 2019-02-22 15:43:02 -04:00
init.cpp Merge #19671: wallet: Remove -zapwallettxes 2020-09-01 09:26:28 +08:00
ismine.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
load.cpp refactor: Pass wallet database into CWallet::Create 2020-09-03 12:24:32 -04:00
load.h wallet: Reload previously loaded wallets on GUI startup 2020-09-01 12:13:50 -04:00
rpcdump.cpp rpc: Assert that RPCArg names are equal to CRPCCommand ones (rpcdump) 2020-08-14 12:38:03 +02:00
rpcwallet.cpp [rpc] add send method 2020-09-10 13:44:53 +02:00
rpcwallet.h refactor: Combine GetWalletForJSONRPCRequest and EnsureWalletIsAvailable functions 2020-06-05 08:29:18 -04:00
salvage.cpp wallet: Remove path checking code from bitcoin-wallet tool 2020-09-03 12:24:32 -04:00
salvage.h wallettool: Have RecoverDatabaseFile return errors and warnings 2020-07-26 20:22:45 -04:00
scriptpubkeyman.cpp Merge #19046: Replace CWallet::Set* functions that use memonly with Add/Load variants 2020-07-11 23:08:54 +12:00
scriptpubkeyman.h Add missed thread safety annotations 2020-08-29 20:46:23 +03:00
wallet.cpp bugfix: make LoadWallet assigns status always 2020-09-10 00:47:31 +09:00
wallet.h Merge #19754: wallet, gui: Reload previously loaded wallets on startup 2020-09-03 18:24:32 +02:00
walletdb.cpp wallet: Remove path checking code from bitcoin-wallet tool 2020-09-03 12:24:32 -04:00
walletdb.h wallet: Remove path checking code from bitcoin-wallet tool 2020-09-03 12:24:32 -04:00
wallettool.cpp wallet: Remove path checking code from bitcoin-wallet tool 2020-09-03 12:24:32 -04:00
wallettool.h wallet: Remove path checking code from bitcoin-wallet tool 2020-09-03 12:24:32 -04:00
walletutil.cpp wallet: Add MakeDatabase function 2020-09-03 12:24:32 -04:00
walletutil.h Remove WalletLocation class 2020-09-03 12:24:32 -04:00