diff options
author | MeshCollider <dobsonsa68@gmail.com> | 2019-07-17 19:45:14 +1200 |
---|---|---|
committer | MeshCollider <dobsonsa68@gmail.com> | 2019-07-17 19:45:55 +1200 |
commit | 459baa1756b7f2d10d261daa0d0f5f4b91cef21f (patch) | |
tree | 378e6b2eba9235745ad0fc91bbeffc4a057dadda /src/test | |
parent | 24dbcf380844f326b6a4e59466dba892314d2843 (diff) | |
parent | e10e1e8db043e9b7c113e07faf408f337c1b732d (diff) |
Merge #16208: wallet: Consume ReserveDestination on successful CreateTransaction
e10e1e8db043e9b7c113e07faf408f337c1b732d Restrict lifetime of ReserveDestination to CWallet::CreateTransaction (Gregory Sanders)
d9ff862f2d24784ee081a8f62a76ffdfe409c10a 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 e10e1e8db043e9b7c113e07faf408f337c1b732d Reviewed the diff
stevenroose:
utACK e10e1e8db043e9b7c113e07faf408f337c1b732d
meshcollider:
utACK e10e1e8db043e9b7c113e07faf408f337c1b732d
Tree-SHA512: 78d047a00f39ab41cfa297052cc1e9c224d5f47d3d2299face650d71827635de077ac33fb4ab9f7dc6fc5a27f4a68415a1bc9ca33a3cb09a78f4f15b2a48411b
Diffstat (limited to 'src/test')
0 files changed, 0 insertions, 0 deletions