lbrycrd/src/wallet
MeshCollider 459baa1756
Merge #16208: wallet: Consume ReserveDestination on successful CreateTransaction
e10e1e8db0 Restrict lifetime of ReserveDestination to CWallet::CreateTransaction (Gregory Sanders)
d9ff862f2d CreateTransaction calls KeepDestination on ReserveDestination before success (Gregory Sanders)

Pull request description:

  The typical usage pattern of `ReserveDestination` is to explicitly `KeepDestination`, or `ReturnDestination` when it's detected it will not be used.

  Implementers such as myself may fail to complete this pattern, and could result in key re-use: https://github.com/bitcoin/bitcoin/pull/15557#discussion_r271956393

  Since ReserveDestination is currently only used directly in the `CreateTransaction`/`CommitTransaction` flow(or fee bumping where it's just used in `CreateTransaction`), I instead make the assumption that if a transaction is returned by `CreateTransaction` it's highly likely that it will be accepted by the caller, and the `ReserveDestination` kept. This simplifies the API as well. There are very few cases where this would not be the case which may result in keys being burned.

  Those failure cases appear to be:
  `CommitTransaction` failing to get the transaction into the mempool
  Belt and suspenders check in `WalletModel::prepareTransaction`

  Alternative to https://github.com/bitcoin/bitcoin/pull/15796

ACKs for top commit:
  achow101:
    ACK e10e1e8db0 Reviewed the diff
  stevenroose:
    utACK e10e1e8db0
  meshcollider:
    utACK e10e1e8db0

Tree-SHA512: 78d047a00f39ab41cfa297052cc1e9c224d5f47d3d2299face650d71827635de077ac33fb4ab9f7dc6fc5a27f4a68415a1bc9ca33a3cb09a78f4f15b2a48411b
2019-07-17 19:45:55 +12:00
..
test Merge #16208: wallet: Consume ReserveDestination on successful CreateTransaction 2019-07-17 19:45:55 +12:00
coincontrol.cpp wallet: avoid reuse flags 2019-05-29 18:40:31 +09:00
coincontrol.h wallet: avoid reuse flags 2019-05-29 18:40:31 +09: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 Make reasoning about dependencies easier by not including unused dependencies 2019-06-02 17:15:23 +02:00
db.h scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04: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 [build]: use #if HAVE_SYSTEM instead of defined(HAVE_SYSTEM) 2019-07-05 18:32:05 +02: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: Bump copyright headers in wallet 2019-05-06 14:05:52 -04: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 rpc: switch to using RPCHelpMan.Check() 2019-07-08 09:53:52 +09:00
rpcwallet.cpp Merge #16208: wallet: Consume ReserveDestination on successful CreateTransaction 2019-07-17 19:45:55 +12: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 Merge #16208: wallet: Consume ReserveDestination on successful CreateTransaction 2019-07-17 19:45:55 +12:00
wallet.h Merge #16208: wallet: Consume ReserveDestination on successful CreateTransaction 2019-07-17 19:45:55 +12:00
walletdb.cpp scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
walletdb.h Have WalletBatch automatically flush every 1000 updates 2019-05-18 12:58:50 -04: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