Commit graph

354 commits

Author SHA1 Message Date
Jonas Schnelli 8c2de827e9
Merge #7061: [Wallet] Add RPC call "rescanblockchain <startheight> <stopheight>"
7a91ceb5e [QA] Add RPC based rescan test (Jonas Schnelli)
c77170fbd [Wallet] add rescanblockchain <start_height> <stop_height> RPC command (Jonas Schnelli)

Pull request description:

  A RPC rescan command is much more flexible for the following reasons:
  * You can define the start and end-height
  * It can be called during runtime
  * It can work in multiwallet environment

Tree-SHA512: df67177bad6ad1d08e5a621f095564524fa3eb87204c2048ef7265e77013e4b1b29f991708f807002329a507a254f35e79a4ed28a2d18d4b3da7a75d57ce0ea5
2017-10-13 15:23:22 -07:00
Jonas Schnelli c77170fbdb
[Wallet] add rescanblockchain <start_height> <stop_height> RPC command 2017-10-12 11:59:21 -07:00
practicalswift 9ad6746ccd Use static_cast instead of C-style casts for non-fundamental types
A C-style cast is equivalent to try casting in the following order:

1. const_cast(...)
2. static_cast(...)
3. const_cast(static_cast(...))
4. reinterpret_cast(...)
5. const_cast(reinterpret_cast(...))

By using static_cast<T>(...) explicitly we avoid the possibility
of an unintentional and dangerous reinterpret_cast. Furthermore
static_cast<T>(...) allows for easier grepping of casts.
2017-09-22 14:59:27 +02:00
MarcoFalke fadf31ef02 wallet: Display non-HD error on first run 2017-09-12 12:40:41 +02:00
Wladimir J. van der Laan c22a53cd63
Merge #11250: Bump wallet version to 159900 and remove the usehd option
713a92073 Remove usehd option and warn when it is used (Andrew Chow)
d4c18f733 Bump wallet version number to 159900 (Andrew Chow)

Pull request description:

  Bump the wallet version number to 159900 so that new wallets made without a default key will no longer work on previous versions at all. Also remove the `usehd` option to avoid weird interaction with wallet version numbers and HD-ness of wallets.

Tree-SHA512: dd7965505bfad6a926c79afd423236f509229a398a8398076f8d57d90a5974243f9459a61225c4daee560c796f427445c9e55a3ad528a3a97a9123ca6a1269ab
2017-09-08 02:28:12 +02:00
Andrew Chow d4c18f7330 Bump wallet version number to 159900 2017-09-07 16:37:07 -07:00
Matt Corallo aece8a4637 (finally) remove getinfo in favor of more module-specific infos 2017-09-06 16:10:04 -07:00
Wladimir J. van der Laan 07c92b98e2
Merge #10976: [MOVEONLY] Move some static functions out of wallet.h/cpp
f01103c MOVEONLY: Init functions wallet/wallet.cpp -> wallet/init.cpp (Russell Yanofsky)
e7fe320 MOVEONLY: Fee functions wallet/wallet.cpp -> wallet/fees.cpp (Russell Yanofsky)
d97fe20 Move some static functions out of wallet.h/cpp (Russell Yanofsky)

Pull request description:

  This just moves some static wallet fee and init functions out of `wallet/wallet.cpp` and into new `wallet/fees.cpp` and `wallet/init.cpp` source files. There is one commit updating declarations and callers, followed by two MOVEONLY commits actually moving the function bodies.

  This change is desirable because wallet.h/cpp are monolithic and hard to navigate, so pulling things out and grouping together pieces of related functionality should improve the organization.

  Another motivation is the wallet process separation work in https://github.com/bitcoin/bitcoin/pull/10973, where (at least initially) parameter parsing and fee estimation are still done in the main process rather than the wallet process, and having functions that run in different processes scrambled up throughout wallet.cpp is unnecessarily confusing.

Tree-SHA512: 6e6982ff82b2ab4e681c043907e2b1801ceb9513394730070f16c46ad338278a863f5b3759aa13db76a259b268b1c919c81f4e339f0796a3cfb990161e8c316d
2017-08-25 21:30:42 +02:00
Wladimir J. van der Laan c559884cac
Merge #10809: optim: mark a few classes final
40a0f9f Enable devirtualization opportunities by using the final specifier (C++11) (practicalswift)
9a1675e optim: mark a few classes final (Cory Fields)

Pull request description:

  Using gcc's ```-Wsuggest-final-types``` and lto, I identified a few easy devirtualization wins:

  > wallet/wallet.h:651:7: warning: Declaring type 'struct CWallet' final would enable devirtualization of 26 calls [-Wsuggest-final-types]

  >coins.h:201:7: warning: Declaring type 'struct CCoinsViewCache' final would enable devirtualization of 13 calls [-Wsuggest-final-types]

  >txdb.h:67:7: warning: Declaring type 'struct CCoinsViewDB' final would enable devirtualization of 5 calls [-Wsuggest-final-types]

  >zmq/zmqnotificationinterface.h:16:7: warning: Declaring type 'struct CZMQNotificationInterface' final would enable devirtualization of 4 calls [-Wsuggest-final-types]

  >httpserver.cpp:42:7: warning: Declaring type 'struct HTTPWorkItem' final would enable devirtualization of 2 calls [-Wsuggest-final-types]

Tree-SHA512: 2a825fd27121ccabaacff5cde2fc8a50d1b4cc846374606caa2a71b0cd8fcb0d3c9b5b3fd342d944998610e2168048601278f8a3709cc515191a0bb2d98ba782
2017-08-21 18:25:48 +02:00
Wladimir J. van der Laan 262167393d
Merge #10952: [wallet] Remove vchDefaultKey and have better first run detection
e53615b Remove vchDefaultKey and have better first run detection (Andrew Chow)

Pull request description:

  Removes vchDefaultKey which was only used for first run detection. Improves wallet first run detection by checking to see if any keys were read from the database.

  This also fixes a (rather contrived) case where an encrypted non-HD wallet has corruption such that the default key is no longer valid and is loaded into a Core version that supports HD wallets. This causes a runtime exception since a new hd master key is generated as the software believes the wallet file is newly created but cannot add the generated key to the wallet since it is encrypted. I was only able to replicate this error by creating a non-hd wallet, encrypting it, then editing the wallet using `db_dump` and `db_load` before loading the wallet with hd enabled. This problem has been reported by [two](https://bitcointalk.org/index.php?topic=1993244.0) [users](https://bitcointalk.org/index.php?topic=1746976.msg17511261#msg17511261) so it is something that can happen, although that raises the question of "what corrupted the default key".

  ~P.S. I don't know what's up with the whitespace changes. I think my text editor is doing something stupid but I don't think those are important enough to attempt undoing them.~ Undid those

Tree-SHA512: 63b485f356566e8ffa033ad9b7101f7f6b56372b29ec2a43b947b0eeb1ada4c2cfe24740515d013aedd5f51aa1890dfbe499d2c5c062fc1b5d272324728a7d55
2017-08-18 18:56:49 +02:00
Wladimir J. van der Laan 0e5b7486cb
Merge #11044: [wallet] Keypool topup cleanups
67ceff4 [wallet] Add logging to MarkReserveKeysAsUsed (John Newbery)
1221f60 [wallet] Remove keypool_topup_cleanups (John Newbery)

Pull request description:

  A couple of minor cleanups suggested by @ryanofsky here: https://github.com/bitcoin/bitcoin/pull/11022#pullrequestreview-55598940

  Does not affect functionality. Not required for v0.15.

Tree-SHA512: d8d0698fd26ea49a4157e68669d5511095760c3a1ecfa3f917e3f273efbafb55c51a202d677614216eae3f796b6e8d17506b2ec2d4799a94f18981b396e65eec
2017-08-18 17:27:17 +02:00
John Newbery 1221f60c94 [wallet] Remove keypool_topup_cleanups
Unused function. Mostly reverts c25d90f125

c25d90f... was merged as part of PR 11022 but is not required.
2017-08-16 17:22:49 -04:00
practicalswift 64fb0ac016 Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
2017-08-16 16:33:25 +02:00
Andrew Chow e53615b443 Remove vchDefaultKey and have better first run detection
Removes vchDefaultKey which was only used for first run detection.
Improves wallet first run detection by checking to see if any keys
were read from the database.

This will now also check for a valid defaultkey for backwards
compatibility reasons and to check for any corruption.

Keys will stil be generated on the first one, but there won't be
any shown in the address book as was previously done.
2017-08-15 15:05:53 -07:00
practicalswift 99ba0c3008 Don't use pass by reference to const for cheaply-copied types (bool, char, etc.). 2017-08-14 17:46:15 +02:00
Russell Yanofsky d97fe2016c Move some static functions out of wallet.h/cpp
This commit just moves a few function declarations and updates callers.
Function bodies are moved in two followup MOVEONLY commits.

This change is desirable because wallet.h/cpp are monolithic and hard to
navigate, so pulling things out and grouping together pieces of related
functionality should improve the organization.

Another proximate motivation is the wallet process separation work in
https://github.com/bitcoin/bitcoin/pull/10973, where (at least initially)
parameter parsing and fee estimation are still done in the main process rather
than the wallet process, and having functions that run in different processes
scrambled up throughout wallet.cpp is unnecessarily confusing.
2017-08-14 11:19:38 -04:00
Wladimir J. van der Laan ce74799a3c
Merge #10483: scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
90d4d89 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL (practicalswift)

Pull request description:

  Since C++11 the macro `NULL` may be:
  * an integer literal with value zero, or
  * a prvalue of type `std::nullptr_t`

  By using the C++11 keyword `nullptr` we are guaranteed a prvalue of type `std::nullptr_t`.

  For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter &
  Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf

  With this patch applied there are no `NULL` macro usages left in the repo:

  ```
  $ git grep NULL -- "*.cpp" "*.h" | egrep -v '(/univalue/|/secp256k1/|/leveldb/|_NULL|NULLDUMMY|torcontrol.*NULL|NULL cert)' | wc -l
  0
  ```

  The road towards `nullptr` (C++11) is split into two PRs:
  * `NULL` → `nullptr` is handled in PR #10483 (scripted, this PR)
  * `0` → `nullptr` is handled in PR #10645 (manual)

Tree-SHA512: 3c395d66f2ad724a8e6fed74b93634de8bfc0c0eafac94e64e5194c939499fefd6e68f047de3083ad0b4eff37df9a8a3a76349aa17d55eabbd8e0412f140a297
2017-08-14 16:30:59 +02:00
Wladimir J. van der Laan 653a46dd91
Merge #11022: Basic keypool topup
d34957e [wallet] [tests] Add keypool topup functional test (Jonas Schnelli)
095142d [wallet] keypool mark-used and topup (John Newbery)
c25d90f [wallet] Add HasUnusedKeys() helper (John Newbery)
f2123e3 [wallet] Cache keyid -> keypool id mappings (John Newbery)
83f1ec3 [wallet] Don't hold cs_LastBlockFile while calling setBestChain (John Newbery)
2376bfc [wallet] [moveonly] Move LoadKeyPool to cpp (Matt Corallo)
cab8557 [wallet] [moveonly] Move CAffectedKeysVisitor (Jonas Schnelli)

Pull request description:

  This PR contains the first part of #10882 :

  - if a key from the keypool is used, mark all keys up to that key as used, and then try to top up the keypool
  - top up the keypool on startup

  Notably, it does not stop the node or prevent the best block from advancing if the keypool drops below a threshold (which means that transactions may be missed and funds lost if restoring from an old HD wallet backup).

Tree-SHA512: ac681fefeaf7ec2aab2fa1da93d12273ea80bd05eb48d7b3b551ea6e5d975dd97ba7de52b7fba52993823280ac4079cc36cf78a27dac708107ebf8fb6326142b
2017-08-14 16:08:44 +02:00
John Newbery 095142d1f9 [wallet] keypool mark-used and topup
This commit adds basic keypool mark-used and topup:

- try to topup the keypool on initial load
- if a key in the keypool is used, mark all keys before that as used and
try to top up
2017-08-10 13:44:02 -04:00
practicalswift 90d4d89230 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
-BEGIN VERIFY SCRIPT-
sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h
sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp
sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp
sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp
sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp
sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp
-END VERIFY SCRIPT-
2017-08-07 07:36:37 +02:00
Matt Corallo 01699fb283 Fix resendwallettransactions assert failure if -walletbroadcast=0 2017-08-06 21:40:56 -04:00
John Newbery c25d90f125 [wallet] Add HasUnusedKeys() helper 2017-08-04 16:42:53 -04:00
John Newbery f2123e3a7b [wallet] Cache keyid -> keypool id mappings 2017-08-04 11:08:39 -04:00
Matt Corallo 2376bfcf24 [wallet] [moveonly] Move LoadKeyPool to cpp 2017-08-02 17:31:35 -04:00
John Newbery 09eacee6b2 [wallet] fix comment for CWallet::Verify() 2017-07-20 16:55:12 -04:00
Wladimir J. van der Laan 9022aa3722
Merge #10817: Redefine Dust and add a discard_rate
f4d00e6 Add a discard_rate (Alex Morcos)
b138585 Remove factor of 3 from definition of dust. (Alex Morcos)

Pull request description:

  The definition of dust is redefined to remove the factor of 3.

  Dust is redefined to be the value of an output such that it would
  cost that value in fees to (create and) spend the output at the dust
  relay rate.  The previous definition was that it would cost 1/3 of the
  value.  The default dust relay rate is correspondingly increased to
  3000 sat/kB so the actual default dust output value of 546 satoshis
  for a non-segwit output remains unchanged.  This commit is a refactor
  only unless a dustrelayfee is passed on the commandline in which case
  that number now needs to be increased by a factor of 3 to get the same
  behavior.  -dustrelayfee is a hidden command line option.

  Note: It's not exactly a refactor due to edge case changes in rounding
  as evidenced by the required change to the unit test.

  A discard_rate is added which defaults to 10,000 sat/kB

  Any change output which would be dust at the discard_rate you are
  willing to discard completely and add to fee (as well as continuing to
  pay the fee that would have been needed for creating the change)

  This would be a nice addition for 0.15 and I think will remain useful for 0.16 with the new coin selection algorithms in discussion, but its not crucial.

  It does add translation strings, but we could (should?) avoid that by hiding the option

Tree-SHA512: 5b6f655354d0ab6b8b6cac1e8d1fe3136d10beb15c6d948fb15bfb105155a9d03684c6240624039b3eed6428b7e60e54216cc8b2f90c4600701e39f646284a9b
2017-07-19 16:46:49 +02:00
Matt Corallo cf82a9e704 Do not allow users to get keys from keypool without reserving them
fundrawtransaction allows users to add a change output and then
not have it removed from keypool. While it would be nice to have
users follow the normal CreateTransaction/CommitTransaction process
we use internally, there isnt much benefit in exposing this option,
especially with HD wallets, while there is ample room for users to
misunderstand or misuse this option.

This could be particularly nasty in some use-cases (especially
pre-HD-split) - eg a user might fundrawtransaction, then call
getnewaddress, hand out the address for someone to pay them, then
sendrawtransaction. This may result in the user thinking they have
received payment, even though it was really just their own change!

This could obviously result in needless key-reuse.
2017-07-18 11:20:47 -04:00
Alex Morcos f4d00e63f7 Add a discard_rate
Any change output which would be dust at the discard_rate you are
willing to discard completely and add to fee (as well as continuing to
pay the fee that would have been needed for creating the change).
2017-07-17 13:40:30 -04:00
Matt Corallo 1fc8c3de0c No longer ever reuse keypool indexes
This fixes an issue where you could reserve a keypool entry, then
top up the keypool, writing out a new key at the given index, then
return they key from the pool. This isnt likely to cause issues,
but given there is no reason to ever re-use keypool indexes
(they're 64 bits...), best to avoid it alltogether.
2017-07-17 12:12:48 -04:00
practicalswift 40a0f9fb96 Enable devirtualization opportunities by using the final specifier (C++11)
* Declaring CCoinsViewErrorCatcher final enables devirtualization of two calls
* Declaring CReserveKey final enables devirtualization of one call
2017-07-17 11:35:13 -04:00
Cory Fields 9a1675ee5b optim: mark a few classes final 2017-07-17 11:34:38 -04:00
Wladimir J. van der Laan 0b019357ff
Merge #10831: Batch flushing operations to the walletdb during top up and increase keypool size.
b0e8e2d Print one log message per keypool top-up, not one per key. (Gregory Maxwell)
41dc163 Increase wallet default keypool size to 1000. (Gregory Maxwell)
30d8f3a Pushdown walletdb though CWallet::AddKeyPubKey to avoid flushes. (Gregory Maxwell)
3a53f19 Pushdown walletdb object through GenerateNewKey/DeriveNewChildKey. (Gregory Maxwell)

Pull request description:

  This carries the walletdb object from top-up through GenerateNewKey/DeriveNewChildKey/CWallet::AddKeyPubKey, which allows us to avoid the flush on destruction until the top up finishes instead of flushing the wallet for every key.

  This speeds up adding keys by well over 10x on my laptop (actually something like 17x), I wouldn't be surprised if it were an even bigger speedup on spinning rust.

  Then it increases the keypool size to 1000. I would have preferred to use 10,000 but in the case where the user creates a new wallet and then turns on encryption it seems kind of dumb to have >400KB of marked-used born unencrypted keys just laying around.

  (Thanks to Matt for cluesticking me on how to bypass the crypter spaghetti)

Tree-SHA512: 868303de38fce4c3f67d7fe133f765f15435c94b39d252d7450b5fee5c607a3cc2f5e531861a69d8c8877bf130e0ff4c539f97500a6bc0ff6d67e4a42c9385c7
2017-07-17 17:16:12 +02:00
Gregory Maxwell 41dc163587 Increase wallet default keypool size to 1000. 2017-07-17 13:46:14 +00:00
Gregory Maxwell 30d8f3a18e Pushdown walletdb though CWallet::AddKeyPubKey to avoid flushes.
This prevents the wallet from being flushed between each and
 every key during top-up.  This results in a >10x speed-up
 for the top-up.
2017-07-17 13:46:07 +00:00
Wladimir J. van der Laan 6859ad2936
Merge #10706: Improve wallet fee logic and fix GUI bugs
11590d3 Properly bound check conf_target in wallet RPC calls (Alex Morcos)
fd29d3d Remove checking of mempool min fee from estimateSmartFee. (Alex Morcos)
2fffaa9 Make QT fee displays use GetMinimumFee instead of estimateSmartFee (Alex Morcos)
1983ca6 Use CoinControl to pass custom fee setting from QT. (Alex Morcos)
03ee701 Refactor to use CoinControl in GetMinimumFee and FeeBumper (Alex Morcos)
ecd81df Make CoinControl a required argument to CreateTransaction (Alex Morcos)

Pull request description:

  This builds on #10589  (first 5 commits from that PR, last 5 commits are new)

  The first couple commits refactor to use the CCoinControl class to pass fee calculation parameters around.

  This allows for fixing the buggy interaction in QT between the global payTxFee which can be modified by the RPC call settxfee or temporarily modified by the QT custom fee settings.  Before these changes the GUI could sometimes send a transaction with a recently set payTxFee and not respect the settings displayed in the GUI.   After these changes, using the GUI does not involve the global transaction confirm target or payTxFee.

  The prospective fee displays in the smart fee slider and the coin control dialog are changed to use the fee calculation from GetMinimumFee, this simplifies the code and makes them slightly more correct in edge cases.

  Maxing the fee calculation with the mempool min fee is move from estimateSmartFee to GetMinimumFee.

  This fixes a long standing bug, and should be tagged for 0.15 as it is holding up finalizing the estimatesmartfee RPC API before release.

Tree-SHA512: 4d36a1bd5934aa62f3806d380fcafbef73e9fe5bdf190fc5259a3e3a13349e5ce796e50e7068c46dc630ccf56d061bce5804f0bfe2e082bb01ca725b63efd4c1
2017-07-17 09:25:33 +02:00
Gregory Maxwell 3a53f19718 Pushdown walletdb object through GenerateNewKey/DeriveNewChildKey.
This is needed but not sufficient for batching the wallet flushing
 when topping up the keypool.
2017-07-16 00:11:31 +00:00
Pieter Wuille 5cfdda2503
Merge #10235: Track keypool entries as internal vs external in memory
d40a72ccb Clarify *(--.end()) iterator semantics in CWallet::TopUpKeyPool (Matt Corallo)
28301b978 Meet code style on lines changed in the previous commit (Matt Corallo)
4a3fc3562 Track keypool entries as internal vs external in memory (Matt Corallo)

Pull request description:

  This is an alternative version of #10184. As @jonasschnelli points out there, the performance regressions are pretty minimal, but given that this is a pretty simple, mechanical change, its probably worth doing.

Tree-SHA512: e83f9ebf2998f8164d1b2eebe5e6dcdeadea8c30b7612861f830758c08bf4093cd6a67b3bcfa9cfcb139e5e0b106fc8898a975fc69f334981aefc756568ab613
2017-07-15 14:02:05 -07:00
Alex Morcos 2fffaa9738 Make QT fee displays use GetMinimumFee instead of estimateSmartFee
Remove helper function (CalculateEstimateType) for determining whether
estimates should be conservative or not, now that this is only called
once from GetMinimumFee and incorporate the logic directly there.
2017-07-14 23:41:37 -04:00
Alex Morcos 03ee701161 Refactor to use CoinControl in GetMinimumFee and FeeBumper
Improve parameter precedence in coin_control
2017-07-14 23:10:58 -04:00
Alex Morcos ecd81dfa3c Make CoinControl a required argument to CreateTransaction 2017-07-14 23:07:18 -04:00
Matt Corallo 4a3fc35629 Track keypool entries as internal vs external in memory
This resolves a super minor performance regressions in several
keypool-handling functions
2017-07-14 21:25:21 -04:00
Alex Morcos f0bf33da83 Change default fee estimation mode.
Fee estimates will default to be non-conservative if the transaction in question is opt-in-RBF.
2017-07-06 22:20:23 -04:00
Alex Morcos d507c301bc Introduce a fee estimate mode.
GetMinimumFee now passes the conservative argument into estimateSmartFee.
Call CalculateEstimateType(mode) before calling GetMinimumFee or estimateSmartFee to determine the value of this argument.
CCoinControl can now be used to control this mode.
2017-07-06 22:20:23 -04:00
Alex Morcos cfaef69ace remove default argument from GetMinimumFee 2017-07-06 22:20:23 -04:00
Wladimir J. van der Laan d81bec7666
Merge #10683: rpc: Move the generate RPC call to rpcwallet
2a96283 rpc: Update `generate` for developer notes (Wladimir J. van der Laan)
df7e2f0 rpc: Move the `generate` RPC call to rpcwallet (Wladimir J. van der Laan)

Tree-SHA512: ec658d6178f8435dc54b9d9c6dd59f873055a8ae0c3f177c02049d77b93107dd5fc17a1ff56d50f051810d52fdf306846eaba2ef4fc8d2a6cfa831f57a1045c4
2017-07-03 13:59:50 +02:00
Wladimir J. van der Laan df7e2f057b rpc: Move the generate RPC call to rpcwallet
This makes it possible to mine to any wallet when multi-wallet mode is added.
Solves the same problem as #10649, but IMO in a cleaner way.

It also gets rid of the circuitous `ScriptForMining` method on
`CValidationInterface`, which really doesn't belong there.

After this change it's still possible to mine without wallet through
`generatetoaddress`.
2017-06-29 12:02:43 +02:00
practicalswift aa95947ded Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class 2017-06-28 02:12:06 +02:00
Wladimir J. van der Laan bef02fb6ac
Merge #10412: Improve wallet rescan API
deaf48b Handle TIMESTAMP_WINDOW within CWallet::RescanFromTime (Russell Yanofsky)
5b2be2b Make CWallet::RescanFromTime comment less ambiguous (Russell Yanofsky)
9bb66ab Add RescanFromTime method and use from rpcdump (Russell Yanofsky)
ccf84bb Move birthday optimization out of ScanForWalletTransactions (Russell Yanofsky)

Tree-SHA512: cd38433b8f5c5e44ecfba830a6a26bd9a9d0f4a22ae42bce17773d1a6fb25e1ee4289484996dad2d7acfa03059917ff062459f25030a761da7083ba5fbc87bc9
2017-06-24 16:37:42 +02:00
Pavel Janík cc0ed26753 Supress struct/class mismatch warnings introduced in #10284. 2017-06-15 14:43:44 +02:00
Wladimir J. van der Laan c2ab38bdd5
Merge #10284: Always log debug information for fee calculation in CreateTransaction
1bebfc8 Output Fee Estimation Calculations in CreateTransaction (Alex Morcos)

Tree-SHA512: e25a27f7acbbc3a666d5d85da2554c5aaec4c923ee2fdbcfc532c29c6fbdec3c9e0d6ae6044543ecc339e7bd81df09c8d228e0b53a2c5c2dae0f1098c9453272
2017-06-15 14:20:14 +02:00
Alex Morcos 1bebfc8d3a Output Fee Estimation Calculations in CreateTransaction 2017-06-13 12:35:04 -04:00
Wladimir J. van der Laan 177433ad22
Merge #8694: Basic multiwallet support
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
2017-06-12 13:27:17 +02:00
Wladimir J. van der Laan 46311e792f
Merge #9672: Opt-into-RBF for RPC & bitcoin-tx
9a5a1d7 RPC/rawtransaction: createrawtransaction: Check opt_into_rbf when provided with either value (Luke Dashjr)
23b0fe3 bitcoin-tx: rbfoptin: Avoid touching nSequence if the value is already opting in (Luke Dashjr)
b005bf2 Introduce MAX_BIP125_RBF_SEQUENCE constant (Luke Dashjr)
575cde4 [bitcoin-tx] add rbfoptin command (Jonas Schnelli)
5d26244 [Tests] extend the replace-by-fee test to cover RPC rawtx features (Jonas Schnelli)
36bcab2 RPC/Wallet: Add RBF support for fundrawtransaction (Luke Dashjr)
891c5ee Wallet: Refactor FundTransaction to accept parameters via CCoinControl (Luke Dashjr)
578ec80 RPC: rawtransaction: Add RBF support for createrawtransaction (Luke Dashjr)

Tree-SHA512: 446e37c617c188cc3b3fd1e2841c98eda6f4869e71cb3249c4a9e54002607d0f1e6bef92187f7894d4e0746ab449cfee89be9f6a1a8831e25c70cf912eac1570
2017-06-07 15:31:40 +02:00
Pieter Wuille be3e042c20
Merge #10523: Perform member initialization in initialization lists where possible
656dbd871 Perform member initialization in initialization lists where possible (practicalswift)

Tree-SHA512: 048380f4da23ab1eaaf471801a01dbd76f2235afb686c1489b30a6bac109195134afc83414b8378d3482a9042d537ec62d30136dadb9347cf06b07fb5c693208
2017-06-06 17:00:19 -07:00
Luke Dashjr b124cf04ea Wallet: Replace pwalletMain with a vector of wallet pointers 2017-06-06 21:17:09 +00:00
Luke Dashjr 891c5eeec2 Wallet: Refactor FundTransaction to accept parameters via CCoinControl 2017-06-05 23:12:03 +00:00
Luke Dashjr 23fb9adaea wallet: Move nAccountingEntryNumber from static/global to CWallet 2017-06-05 21:04:42 +00:00
Russell Yanofsky 9bb66ab660 Add RescanFromTime method and use from rpcdump
No change in behavior.
2017-06-05 09:59:58 -05:00
practicalswift 656dbd871a Perform member initialization in initialization lists where possible 2017-06-04 01:09:48 +02:00
Russell Yanofsky 88b8f0b682 Simplify feebumper minimum fee code slightly
No change in behavior. Get rid of specifiedConfirmTarget if/else block and
rename specifiedConfirmTarget and ignoreUserSetFee variables to
ignoreGlobalPayTxFee.
2017-05-25 10:13:28 -04:00
Russell Yanofsky d944bd7a27 [qt] Move some WalletModel functions into CWallet
Motivation for moving these is to make supporting IPC simpler (#10102), so
these lookups can be one-shot IPC requests, instead of back-and-forth
interactions over the IPC channel.

Also these functions are potentially useful outside of the bitcoin GUI (e.g.
for RPCs).
2017-05-17 05:18:25 -04:00
Pedro Branco bc63d0ed3b Add query options to listunspent rpc call 2017-05-17 08:37:34 +02:00
Karl-Johan Alm 5a5e4e9cc1
[wallet] Remove CTransaction&() helper conversion operator from wallet implementation. 2017-05-09 15:46:26 +09:00
Jorge Timón 381a46e38f
Consensus: Policy: MOVEONLY: Move CFeeRate out of the consensus module
...from amount.o to policy/feerate.o

Policy, because it moves policy code to the policy directory (common module)
2017-05-03 18:00:13 +02:00
Wladimir J. van der Laan d3dce0eb67
Merge #10115: Avoid reading the old hd master key during wallet encryption
185c7f0 Avoid reading the old hd master key during wallet encryption (Matt Corallo)

Tree-SHA512: b744e8490c0e948355bb77b2695902bb99f89a68af46aa2be9120bd2ccf3c340eb8a56340fec117f9a935192298028945c9b18120ee6b8b23e7da8ffdb635745
2017-05-03 09:11:45 +02:00
Alex Morcos 3edbd79a65 cleanup: reduce to one GetMinimumFee call signature 2017-04-26 15:54:23 -04:00
Russell Yanofsky 02d9f50d5f [wallet] Remove unneeded legacy getbalance code 2017-04-26 06:36:38 -04:00
Russell Yanofsky 82b7dc373a [wallet] Add GetLegacyBalance method to simplify getbalance RPC
This adds a simpler new implementation of getbalance logic along with asserts
to confirm it behaves identically to the old logic. The old logic is removed in
the next commit.
2017-04-26 06:36:38 -04:00
Wladimir J. van der Laan fa1ac2881f
Merge #9951: Wallet database handling abstractions/simplifications
911a480 wallet: Add comment describing the various classes in walletdb.h (Wladimir J. van der Laan)
69d2e9b wallet: Make IsDummy private in CWalletDBWrapper (Wladimir J. van der Laan)
3323281 wallet: CWalletDB CDB composition not inheritance (Wladimir J. van der Laan)
be9e1a9 wallet: Reduce references to global bitdb environment (Wladimir J. van der Laan)
071c955 wallet: Get rid of fFileBacked (Wladimir J. van der Laan)
71afe3c wallet: Introduce database handle wrapper (Wladimir J. van der Laan)

Tree-SHA512: e4e72953c61a2f6995d609a32f8ed8e18cab9a92bc9e193d46a1d1f06d9daa5c6da6fce2867d4e3ba4fc0439141901a3d35f246486f0fa8f59587786379dfcbd
2017-04-24 16:31:34 +02:00
Wladimir J. van der Laan 14c948987f
Merge #9942: Refactor CBlockPolicyEstimator
68af651 MOVEONLY: move TxConfirmStats to cpp (Alex Morcos)
2332f19 Initialize TxConfirmStats in constructor (Alex Morcos)
5ba81e5 Read and Write fee estimate file directly from CBlockPolicyEstimator (Alex Morcos)
14e10aa Call estimate(Smart)Fee directly from CBlockPolicyEstimator (Alex Morcos)
dbb9e36 Give CBlockPolicyEstimator it's own lock (Alex Morcos)
f6187d6 Make processBlockTx private. (Alex Morcos)
ae7327b Make feeEstimator its own global instance of CBlockPolicyEstimator (Alex Morcos)

Tree-SHA512: dbf3bd2b30822e609a35f3da519b62d23f8a50e564750695ddebd08553b4c01874ae3e07d792c6cc78cc377d2db33b951ffedc46ac7edaf5793f9ebb931713af
2017-04-20 21:17:17 +02:00
Wladimir J. van der Laan 071c95570b wallet: Get rid of fFileBacked
Instead, CWalletDB() with a dummy handle will just give you a no-op
database in which writes always succeeds and reads always fail. CDB
already had functionality for this, so just use that.
2017-04-20 17:15:31 +02:00
Wladimir J. van der Laan 71afe3c099 wallet: Introduce database handle wrapper
Abstract database handle from explicit strFilename into
CWalletDBWrapper.

Also move CWallet::Backup to db.cpp - as it deals with representation
details this is a database specific operation.
2017-04-20 17:15:30 +02:00
Jonas Schnelli e96486cbeb
Merge #10221: Stop treating coinbase outputs differently in GUI: show them at 1conf
608bbcc [qt] Stop treating coinbase outputs differently: show them at 1conf (Matt Corallo)

Tree-SHA512: 62ba10520da8b83cf8e97c86dec3ccdcca8b7bfae0174d1a4099d33aa5d11933cc7c248394bf67c2b105211cf7931955816c741957832e703211030c7f4f002f
2017-04-19 11:15:06 +02:00
Wladimir J. van der Laan 393160cf6c
Merge #10208: [wallet] Rescan abortability
9141622 [rpc] Add abortrescan command to RPC interface. (Kalle Alm)
75a08e7 [wallet] Add support for aborting wallet transaction rescans. (Kalle Alm)

Tree-SHA512: 18545a1dc48c6dc112993f971f3adc7c0341fa621186c6d70bef1052e1d127ca116c5769595d721a209d502ca2019f2ad33876fe35d2b17216393404607a6c76
2017-04-18 08:05:24 +02:00
Kalle Alm 75a08e7d17
[wallet] Add support for aborting wallet transaction rescans. 2017-04-17 23:35:53 +09:00
Matt Corallo 608bbccfb9 [qt] Stop treating coinbase outputs differently: show them at 1conf 2017-04-17 10:16:21 -04:00
Wladimir J. van der Laan 2584925077
Merge #10178: Remove CValidationInterface::UpdatedTransaction
9fececb Remove CValidationInterface::UpdatedTransaction (Matt Corallo)
d89f8ad Make DisconnectBlock and ConnectBlock static in validation.cpp (Matt Corallo)

Tree-SHA512: 146597b538c09c1e8071f4f88ffeba0645c6816f86030b142174bd298cc18ae09a400e6ca8de04d091e37b635f99f4c05982c09e6729691eb8ca6b8439ab97ca
2017-04-17 14:46:04 +02:00
Matt Corallo 185c7f08be Avoid reading the old hd master key during wallet encryption
This makes SetHDMasterKey responsible for maintinaing the CHDChain
version instead of always creating it with the latest version and
making EncryptWallet responsible for keeping the version from
changing.
2017-04-13 11:55:43 -04:00
Matt Corallo 9fececb2cb Remove CValidationInterface::UpdatedTransaction
This removes another callback from block connection logic, making it
easier to reason about the wallet-RPCs-returns-stale-info issue.

UpdatedTransaction was previously used by the GUI to display
coinbase transactions only after they have a block built on top of
them. This worked fine for in most cases, but only worked due to a
corner case if the user received a coinbase payout in a block
immediately prior to restart. In that case, the normal process of
caching the most recent coinbase transaction's hash would not work,
and instead it would only work because of the on-load -checkblocks
calling DisconnectBlock and ConnectBlock on the current tip.

In order to make this more robust, a full mapWallet loop after the
first block which is connected after restart was added.
2017-04-13 10:36:21 -04:00
Wladimir J. van der Laan 70f6f56e9d
Merge #10165: [Wallet] Refactoring by using CInputCoin instead of std::pair
c37e32a [Wallet] Prevent CInputCoin to be in a null state (NicolasDorier)
f597dcb [Wallet] Simplify code using CInputCoin (NicolasDorier)
e78bc45 [Wallet] Decouple CInputCoin from CWalletTx (NicolasDorier)
fd44ac1 [Wallet] Rename std::pair<const CWalletTx*, unsigned int> to CInputCoin (NicolasDorier)

Tree-SHA512: d24361fc514a0566bce1c3953d766dfe4fece79c549cb4db2600695a4ce08e85caa61b7717812618e523a2f2a1669877dad2752ed079e2ed2d27249f9bc8590e
2017-04-13 12:08:26 +02:00
NicolasDorier c37e32af0d [Wallet] Prevent CInputCoin to be in a null state 2017-04-13 05:32:24 +00:00
NicolasDorier e78bc45810 [Wallet] Decouple CInputCoin from CWalletTx 2017-04-13 05:30:52 +00:00
John Newbery d0cd0bd6d9 Make CWallet::SyncTransactions() interface friendlier 2017-04-11 17:17:46 -04:00
Wladimir J. van der Laan 67023e9004
Merge #9725: CValidationInterface Cleanups
b1a6d4c Take a CTransactionRef in AddToWalletIfInvolvingMe to avoid a copy (Matt Corallo)
1c95e2f Use std::shared_ptr instead of boost::shared_ptr in ScriptForMining (Matt Corallo)
91f1e6c Remove dead-code tracking of requests for blocks we generated (Matt Corallo)
acad82f Add override to functions using CValidationInterface methods (Matt Corallo)
e6d5e6c Hold cs_wallet for whole block [dis]connection processing (Matt Corallo)
461e49f SyncTransaction->TxAddedToMempool/BlockConnected/Disconnected (Matt Corallo)
f404334 Handle SyncTransaction in ActivateBestChain instead of ConnectTrace (Matt Corallo)
a147687 Keep conflictedTxs in ConnectTrace per-block (Matt Corallo)
d3167ba Handle conflicted transactions directly in ConnectTrace (Matt Corallo)
29e6e23 Make ConnectTrace::blocksConnected private, hide behind accessors (Matt Corallo)
822000c Add pblock to connectTrace at the end of ConnectTip, not start (Matt Corallo)
f5e9a01 Include missing #include in zmqnotificationinterface.h (Matt Corallo)

Tree-SHA512: 8893d47559da3b28d2ef7359768547cba8a4b43b6f891d80f5848f995a84b1517bfb0f706fdc8cd43f09a1350349eb440d9724a59363ab517dfcc4fcb31b2018
2017-04-10 21:21:01 +02:00
Alex Morcos 14e10aa842 Call estimate(Smart)Fee directly from CBlockPolicyEstimator 2017-04-10 13:56:50 -04:00
NicolasDorier fd44ac1e8b [Wallet] Rename std::pair<const CWalletTx*, unsigned int> to CInputCoin 2017-04-08 03:50:14 +00:00
Matt Corallo b1a6d4cd56 Take a CTransactionRef in AddToWalletIfInvolvingMe to avoid a copy 2017-04-07 11:53:43 +02:00
Matt Corallo 1c95e2f9c9 Use std::shared_ptr instead of boost::shared_ptr in ScriptForMining 2017-04-07 11:53:43 +02:00
Matt Corallo 91f1e6ce5e Remove dead-code tracking of requests for blocks we generated 2017-04-07 11:53:43 +02:00
Matt Corallo 461e49fee2 SyncTransaction->TxAddedToMempool/BlockConnected/Disconnected
This simplifies fixing the wallet-returns-stale-info issue as we
can now hold cs_wallet across an entire block instead of only
per-tx (though we only actually do so in the next commit).

This change also removes the NOT_IN_BLOCK constant in favor of only
passing the CBlockIndex* parameter to SyncTransactions when a new
block is being connected, instead of also when a block is being
disconnected.

This change adds a parameter to BlockConnectedDisconnected which
lists the transactions which were removed from mempool due to
confliction as a result of this operation. While its somewhat of a
shame to make block-validation-logic generate a list of mempool
changes to be included in its generated callbacks, fixing this isnt
too hard.

Further in this change-set, CValidationInterface starts listening
to mempool directly, placing it in the middle and giving it a bit
of logic to know how to route notifications from block-validation,
mempool, etc (though not listening for conflicted-removals yet).
2017-04-07 11:53:43 +02:00
Jonas Schnelli 0337a39d31
Refactor Bumpfee core functionality 2017-04-02 10:12:39 +02:00
Jonas Schnelli 9382f0425e
Do not break backward compatibility during wallet encryption 2017-03-27 09:51:55 +02:00
Jonas Schnelli cd468d07d5
Define CWallet::DeriveNewChildKey() as private 2017-03-24 10:57:31 +01:00
Jonas Schnelli 003e197498
Remove FEATURE_HD_SPLIT bump TODO 2017-03-24 10:28:40 +01:00
Jonas Schnelli 58e148333e
CKeyPool avoid "catch (...)" in SerializationOp 2017-03-24 10:28:40 +01:00
Jonas Schnelli d0a627a53a
Fix issue where CDataStream->nVersion was taken a CKeyPool record version 2017-03-24 10:28:39 +01:00
Jonas Schnelli 02592f4c5e
[Wallet] split the keypool in an internal and external part 2017-03-24 10:28:37 +01:00
Patrick Strateman fb6f90a4ce Initialize nRelockTime 2017-03-14 15:48:08 -07:00
Russell Yanofsky af61d9f78b Add COutput::fSafe member for safe handling of unconfirmed outputs
This exposes a value computed in CWallet::AvailableCoins so it can used for
other things, like inclusion in listunspent output.
2017-03-10 05:11:10 +00:00
NicolasDorier 3cef95058c Trivial: Add const modifier to GetHDChain and IsHDEnabled 2017-03-09 11:32:02 +09:00
Wladimir J. van der Laan 30ff3a2fc9
Merge #9602: Remove coin age priority and free transactions - implementation
b421e6d Update example bitcoin.conf (Alex Morcos)
7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos)
359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos)
f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos)
49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos)
0315888 [test] Remove priority from tests (Alex Morcos)
f838005 No longer allow "free" transactions (Alex Morcos)
ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos)
fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos)
400b151 [debug] Change -printpriority option (Alex Morcos)
272b25a [mining] Remove -blockprioritysize. (Alex Morcos)
12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos)
ddf58c7 wallet: Remove sendfree (MarcoFalke)

Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
2017-03-07 19:30:23 +01:00
Wladimir J. van der Laan 3178b2c740
Merge #9369: Factor out CWallet::nTimeSmart computation into a method.
630fc54 Clean up braces in CWallet::ComputeTimeSmart (Russell Yanofsky)
6c996c2 Add documentation describing CWallet::nTimeSmart. (Russell Yanofsky)
1f98abe Factor out CWallet::nTimeSmart computation into a method. (Russell Yanofsky)
c6b82d1 Add tests for CWalletTx::nTimeSmart (Russell Yanofsky)

Tree-SHA512: 457a30251e572cf20dac0198af1a94128d269b1e0ce6605a213d56fc14d85c84a0a494e3dcbb18c201c4f39e6f7b000bd9cb6f283930d8452e4bb93ba406f8d4
2017-03-07 17:11:59 +01:00
Matt Corallo 735d9b5362 Use CScheduler for wallet flushing, remove ThreadFlushWalletDB 2017-03-06 18:35:19 -05:00
Wladimir J. van der Laan 72fb5158b1
Merge #9906: Disallow copy constructor CReserveKeys
188f89c Disallow copy of CReserveKeys (Gregory Sanders)

Tree-SHA512: e55ce10bf7f2dc91de9797e60ab7767fb51f25255995d62ddf358c52b7aaa23c26fbfb522e1610ff950b86804ddbc38dc0d7708bfab2c4d33ad99a275d8c77db
2017-03-06 18:33:24 +01:00
Gregory Sanders 188f89c3bb Disallow copy of CReserveKeys 2017-03-06 09:26:10 -05:00
Wladimir J. van der Laan fa625b078b
Merge #9333: Document CWalletTx::mapValue entries and remove erase of nonexistent "version" entry.
87ed396 [trivial] Add comment documenting bumpfee mapValues (Russell Yanofsky)
a1fe944 Remove reference to nonexistent "version" wallet transaction mapvalue field (Russell Yanofsky)
654e044 [trivial] Add comment documenting CWalletTx::mapValue (Russell Yanofsky)

Tree-SHA512: 1fd1860e345c59b13634db2007fff4ba30aaf1f177fdd765f47bf9257fac117cdcd5d491424416da304c08e85effbb27f3424f072f7c9587ef39cb98531b932a
2017-03-06 10:18:19 +01:00
Russell Yanofsky 6c996c2df7 Add documentation describing CWallet::nTimeSmart.
Most of the text comes from the 2012 Luke Dashjr <luke-jr+git@utopios.org>
c3f95ef commit message.
2017-03-03 11:22:44 -05:00
Russell Yanofsky 1f98abe47b Factor out CWallet::nTimeSmart computation into a method.
No change in behavior, this change just pulls some code out of
CWallet::AddToWallet that was making it very long into a separate method.
2017-03-03 11:22:44 -05:00
Luke Dashjr 2e518e313b Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet 2017-02-27 20:45:17 +00:00
MarcoFalke ddf58c7573 wallet: Remove sendfree
This removes the option from the wallet to not pay a fee on "small"
transactions which spend "old" inputs.

This code is no longer worth keeping around, as almost all miners
prefer not to include transactions which pay no fee at all.
2017-02-27 11:23:50 -05:00
Russell Yanofsky e2e2f4c856 Return errors from importmulti if complete rescans are not successful 2017-02-17 14:12:31 -05:00
Wladimir J. van der Laan 6c5427d24c wallet: Prevent "overrides a member function but is not marked 'override'" warnings
Because it is used inconsistently at least version 5.4.0 of g++ to
complains about methods that don't use override. There is two ways to go
about this: remove override from the methods having it, or add it to the
methods missing it. I chose the second.
2017-02-15 11:31:28 +01:00
Russell Yanofsky a80f98b1c7 Use importmulti timestamp when importing watch only keys
When importing a watch-only address over importmulti with a specific timestamp,
the wallet's nTimeFirstKey is currently set to 1. After this change, the
provided timestamp will be used and stored as metadata associated with
watch-only key. This can improve wallet performance because it can avoid the
need to scan the entire blockchain for watch only addresses when timestamps are
provided.

Also adds timestamp to validateaddress return value (needed for tests).

Fixes #9034.
2017-02-10 16:11:19 -05:00
Russell Yanofsky a58370e6a2 Dedup nTimeFirstKey update logic
Also make nTimeFirstKey member variable private.

This is just a cleanup change, it doesn't change behavior in any significant
way.
2017-02-10 15:49:00 -05:00
Wladimir J. van der Laan 870cd2b58a
Merge #9378: [trivial] Add documentation for CWalletTx::fFromMe member.
39c77b0 Add documentation for CWalletTx::fFromMe member. (Russell Yanofsky)
2017-02-06 14:58:02 +01:00
Suhas Daftuar d625b907a1 wallet: Refactor dummy signature signing for reusability 2017-01-30 11:47:10 -05:00
Wladimir J. van der Laan d2c9e4d422
Merge #9615: Wallet incremental fee
4b189c1 Change bumpfee result value from 'oldfee' to 'origfee'. (Alex Morcos)
0c0c63f Introduce WALLET_INCREMENTAL_RELAY_FEE (Alex Morcos)
e8021ec Use CWallet::GetMinimumFee in bumpfee (Alex Morcos)
ae9719a Refactor GetMinimumFee to give option of providing targetFee (Alex Morcos)
fe8e8ef [rpc] Add incremental relay fee to getnetworkinfo (Alex Morcos)
6b331e6 Fix to have miner test aware of new separate block min tx fee (Alex Morcos)
de6400d Fix missing use of dustRelayFee (Alex Morcos)
5b15870 Use incrementalRelayFee for BIP 125 replacement (Alex Morcos)
2017-01-30 10:38:56 +01:00
Alex Morcos 0c0c63f70a Introduce WALLET_INCREMENTAL_RELAY_FEE
Have wallet's default bump value be higher than the default incrementalRelayFee to future proof against changes to incremental relay fee.  Only applies when not setting the fee rate directly.
2017-01-26 12:03:47 -05:00
Alex Morcos ae9719ab87 Refactor GetMinimumFee to give option of providing targetFee 2017-01-25 22:24:40 -05:00
Russell Yanofsky 87ed396159 [trivial] Add comment documenting bumpfee mapValues 2017-01-25 13:18:25 -05:00
Wladimir J. van der Laan fb75cd04bb
Merge #9377: fundrawtransaction: Keep change-output keys by default, make it optional
c9f3062 Add fundrawtransactions new reserveChangeKey option to the release notes (Jonas Schnelli)
9eb325d [QA] Add test for fundrawtransactions new reserveChangeKey option (Jonas Schnelli)
9aa4e6a [Wallet] Add an option to keep the change address key, true by default (Jonas Schnelli)
2017-01-20 14:32:42 +01:00
Jonas Schnelli 9aa4e6a6c2
[Wallet] Add an option to keep the change address key, true by default 2017-01-19 20:38:37 +01:00
Wladimir J. van der Laan 2ef52d3cf1
Merge #8456: [RPC] Simplified bumpfee command.
cc0243a [RPC] bumpfee (mrbandrews)
52dde66 [wallet] Add include_unsafe argument to listunspent RPC (Russell Yanofsky)
766e8a4 [wallet] Add IsAllFromMe: true if all inputs are from wallet (Suhas Daftuar)
2017-01-19 19:59:24 +01:00
mrbandrews cc0243ad32 [RPC] bumpfee
This command allows a user to increase the fee on a wallet transaction T, creating a "bumper" transaction B.
T must signal that it is BIP-125 replaceable.
T's change output is decremented to pay the additional fee.  (B will not add inputs to T.)
T cannot have any descendant transactions.
Once B bumps T, neither T nor B's outputs can be spent until either T or (more likely) B is mined.

Includes code by @jonasschnelli and @ryanofsky
2017-01-19 11:29:29 -05:00
Wladimir J. van der Laan 7cb024eba6
Merge #9222: Add 'subtractFeeFromAmount' option to 'fundrawtransaction'.
453bda6 Add 'subtractFeeFromOutputs' option to 'fundrawtransaction'. (Chris Moore)
2017-01-12 12:49:10 +01:00
Suhas Daftuar 766e8a40b4 [wallet] Add IsAllFromMe: true if all inputs are from wallet 2017-01-10 08:14:50 -05:00
Alex Morcos 42f5ce4093 Try to reduce change output to make needed fee in CreateTransaction
Once we've picked coins and dummy-signed the transaction to calculate fee, if we don't have sufficient fee, then try to meet the fee by reducing change before resorting to picking new coins.
2017-01-06 10:12:05 -05:00
Wladimir J. van der Laan c0ddd32bf6
Merge #9450: Increment MIT licence copyright header year on files modified in 2016
27765b6 Increment MIT Licence copyright header year on files modified in 2016 (isle2983)
2017-01-04 12:09:05 +01:00
Pieter Wuille 2a524b8e8f
Merge #8776: Wallet refactoring leading up to multiwallet
5394b39 Wallet: Split main logic from InitLoadWallet into CreateWalletFromFile (Luke Dashjr)
fb0c934 Wallet: Let the interval-flushing thread figure out the filename (Luke Dashjr)
2017-01-03 14:11:11 -08:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Jonas Schnelli 9e351c9586
SetMerkleBranch: remove unused code, remove cs_main lock requirement 2016-12-30 10:37:13 +01:00
Wladimir J. van der Laan 38e4887b46
Merge #8717: [WALLET] Addition of ImmatureCreditCached to MarkDirty()
a560378 [WALLET] Addition of ImmatureCreditCached to MarkDirty() (Spencer Lievens)
2016-12-21 11:30:03 +01:00
Wladimir J. van der Laan 5a70572049
Merge #9262: Prefer coins that have fewer ancestors, sanity check txn before ATMP
cee1612 reduce number of lookups in TransactionWithinChainLimit (Gregory Sanders)
af9bedb Test for fix of txn chaining in wallet (Gregory Sanders)
5882c09 CreateTransaction: Don't return success with too-many-ancestor txn (Gregory Sanders)
0b2294a SelectCoinsMinConf: Prefer coins with fewer ancestors (Gregory Sanders)
2016-12-20 13:27:08 +01:00
Russell Yanofsky 39c77b00e3 Add documentation for CWalletTx::fFromMe member. 2016-12-15 15:14:02 -05:00
Russell Yanofsky a1fe9446e9 Remove reference to nonexistent "version" wallet transaction mapvalue field
This change removes a mapValue.erase("version") statement which deletes a
mapValue entry that never existed. The statement was mistakenly added in commit
865c3a2383 in 2010 and is harmless but confusing.
2016-12-14 05:41:36 -05:00
Chris Moore 453bda63dd Add 'subtractFeeFromOutputs' option to 'fundrawtransaction'. 2016-12-13 13:36:23 -08:00
Gregory Sanders 0b2294a980 SelectCoinsMinConf: Prefer coins with fewer ancestors 2016-12-13 09:41:04 -05:00
Russell Yanofsky 654e0443fb [trivial] Add comment documenting CWalletTx::mapValue 2016-12-12 11:40:00 -05:00
Pieter Wuille c3f5673a63 Make CWalletTx store a CTransactionRef instead of inheriting 2016-12-02 18:28:22 -08:00
Jonas Schnelli f7345050e9
Make strWalletFile const 2016-11-11 14:32:38 +01:00
Luke Dashjr 5394b3940d Wallet: Split main logic from InitLoadWallet into CreateWalletFromFile 2016-11-11 11:35:49 +00:00
Luke Dashjr fb0c934d1b Wallet: Let the interval-flushing thread figure out the filename 2016-11-11 11:35:49 +00:00
Pieter Wuille 528472111b Get rid of nType and nVersion
Remove the nType and nVersion as parameters to all serialization methods
and functions. There is only one place where it's read and has an impact
(in CAddress), and even there it does not impact any of the recursively
invoked serializers.

Instead, the few places that need nType or nVersion are changed to read
it directly from the stream object, through GetType() and GetVersion()
methods which are added to all stream classes.
2016-11-07 13:56:27 -08:00
Wladimir J. van der Laan d1871da7fe
Merge #9071: Declare wallet.h functions inline
2ca882a Declare wallet.h functions inline (Pieter Wuille)
2016-11-03 10:22:11 +01:00
Pieter Wuille ed0cc50afe
Merge #9036: wallet: Change default confirm target from 2 to 6
0fdf810 wallet: Change default confirm target from 2 to 6 (Wladimir J. van der Laan)
2016-11-02 23:36:27 -07:00
Pieter Wuille 2ca882ad41 Declare wallet.h functions inline 2016-11-02 17:29:16 -07:00
Wladimir J. van der Laan 6a1343f73b
Merge #8977: [Wallet] Refactor wallet/init interaction (Reaccept wtx, flush thread)
cab1da7 [Wallet] Refactor wallet/init interaction (Reaccept wtx, flush thread) (Jonas Schnelli)
2016-11-02 21:37:43 +01:00
Wladimir J. van der Laan 0fdf810d26 wallet: Change default confirm target from 2 to 6
Recent discussion (in IRC meetings, and e.g. #8989) has shown a
preference for the default confirm target for smartfees to be 6 instead
of 2, to avoid overpaying fees for questionable gain.

6 is also a compromise between the GUI's pre-#8989 value of 25 and the
bitcoind `-txconfirmtarget` default of 2. These were unified in #8989,
but this has made the (overly expensive) default of 2 as GUI default.
2016-10-28 14:15:46 +02:00
instagibbs 169bdabe14 Return useful error message on ATMP failure 2016-10-26 15:59:33 -04:00
Jonas Schnelli cab1da745b
[Wallet] Refactor wallet/init interaction (Reaccept wtx, flush thread) 2016-10-20 09:22:13 +02:00