Commit graph

860 commits

Author SHA1 Message Date
Wladimir J. van der Laan 08d0390a5f
Merge #10403: Fix importmulti failure to return rescan errors
4d2d604 Fix importmulti failure to return rescan errors (Russell Yanofsky)

Tree-SHA512: e5e6d6c5a2bb7230e1bcac1903a4b766cd57bf781fade50c6c9cd5713cd3e768db0987cfda9699b57a53d3a0a60951b96dce5283b3d3ec1f954162c439bc932b
2017-06-05 16:41:02 +02:00
Wladimir J. van der Laan 0747d33498
Merge #10455: Simplify feebumper minimum fee code slightly
88b8f0b Simplify feebumper minimum fee code slightly (Russell Yanofsky)

Tree-SHA512: 4465daef63936860d016a7fd7fd31ce62878d87cb943a90f321b07a40accdc5e7970d99de46b2bc924eb0b422144d6f01649855949395518790ecd05d300ee52
2017-06-05 16:38:07 +02:00
practicalswift 90593ed92c Limit variable scope 2017-06-05 00:52:36 +02:00
practicalswift 656dbd871a Perform member initialization in initialization lists where possible 2017-06-04 01:09:48 +02:00
practicalswift a8c09affce Remove unused variables 2017-06-03 23:54:24 +02:00
Pieter Wuille 098b01dc58
Merge #10500: Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupings
b9b814a38 Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupings (Russell Yanofsky)

Tree-SHA512: 96a0612ca460ba1bfb3921f3aa348400fd3afa12c40f2ca1f3f04068b1574fe824d577e0123013d8898a4990084316dc1dfb541331849f0996ceff7f4eb25e6b
2017-06-02 16:10:33 -07:00
Russell Yanofsky b9b814a38e Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupings 2017-06-01 11:48:29 -04:00
Wladimir J. van der Laan b6b150b016
Merge #10469: Fixing typo in rpcdump.cpp
16d94d3 Fixing typo in rpcdump.cpp (James Evans)

Tree-SHA512: 84ef1b91c719131196ebed6b865e282b77bee7699614e15884ba59010239a3bbc1380dc8f856c83338f071e3eb3ca41c6b10f830816e6c794531cf6a965d63a9
2017-06-01 13:19:36 +02:00
Wladimir J. van der Laan ef2d062c9f
Merge #10450: Fix bumpfee rpc "errors" return value
1b6602f Fix bumpfee rpc "errors" return value (Russell Yanofsky)

Tree-SHA512: a55d4dbe28c75f31fde3b7de60479265bb8f3777f432d1db321f1dd848d5274c353f757b09ed3cad9c69c08acbf3906679d27052267db943ab2b19629f79bd81
2017-06-01 10:48:19 +02:00
James Evans 16d94d3d03 Fixing typo in rpcdump.cpp 2017-05-27 16:44:10 +01:00
Pieter Wuille b40ceed98a
Merge #10419: [trivial] Fix three recently introduced typos
efc2e3302 [trivial] Fix three recently introduced typos (practicalswift)

Tree-SHA512: 99e97f3c1350299dfce9c0c35547d480f25c0b877da311d9120f113afd3089eda31b88b2378e2370f288b0c41bb69cee0fd3abca661cd93d5a56982f90709f91
2017-05-26 11:56:21 -07: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 1b6602fbe6 Fix bumpfee rpc "errors" return value 2017-05-24 16:15:26 -04:00
Pieter Wuille f2f7e97e8c
Merge #10347: Use range-based for loops (C++11) when looping over vector elements
211adc0 Use range-based for loops (C++11) when looping over vector elements (practicalswift)

Tree-SHA512: 0e007f20dcef99d3c7a1036265e00f689d69f42e02fd82dd8389f45b52d31947e5f9388de2610d3d9bd9f554915ce0d35ebce561e5ae3a9013956d0ee4937145
2017-05-23 14:08:20 -07:00
Wladimir J. van der Laan ce8176d038
Merge #10295: [qt] Move some WalletModel functions into CWallet
108f04f Add missing LOCK2 in CWallet::GetAvailableBalance (Russell Yanofsky)
429aa9e [test] Move some tests from qt -> wallet (Russell Yanofsky)
d944bd7 [qt] Move some WalletModel functions into CWallet (Russell Yanofsky)
ef8ca17 [test] Add tests for some walletmodel functions (Russell Yanofsky)

Tree-SHA512: f6384d9f2ff3f7fb173d414588c3e7dc8c311b8ed2ce2b0979fb824a0ed83a7302890ccd3d83197f07f6fdcb6b1ca151584d90ea1961d88dfe8956c87087cde8
2017-05-23 19:32:52 +02:00
Wladimir J. van der Laan e76a3927c3
Merge #10410: Fix importwallet edge case rescan bug
2a8e35a Fix importwallet edge case rescan bug (Russell Yanofsky)

Tree-SHA512: 59522c962290f9ef64436349d11183dd1fd829e515d1f5ec802b63dd813d04303e28d4f3ba38df77a6c151ee4c14f3ca5d3d82204c57456ac94054de62ae4bc7
2017-05-23 16:39:19 +02:00
practicalswift efc2e3302d [trivial] Fix three recently introduced typos
```
$ git blame src/policy/fees.cpp | grep becuase
3810e976 (2017-03-07 11:33:44 -0500 789)          * checks for 2*target becuase we are taking the max over all time
$ git blame src/policy/fees.h | grep successfullly
2d2e1705 (2017-04-12 12:29:03 -0400  54)  * representing that a tx was successfullly confirmed in less than or equal to
$ git blame src/wallet/feebumper.cpp | grep "hasen't"
a3878374 (2017-05-11 09:34:39 +0200 258)     // make sure the transaction still has no descendants and hasen't been mined in the meantime
```
2017-05-23 13:22:40 +02:00
Wladimir J. van der Laan e4775167cb
Merge #10390: [wallet] remove minimum total fee option
091a9ae remove minimum total fee option (Gregory Sanders)

Tree-SHA512: 9be4df3dab0219f30917211408f47b242f7c96dd7663b06ab1cf3cc63027f14956dc680883be6c58673b6452d0f339cf893694e4f21d0d248e70760614d5a344
2017-05-22 20:01:20 +02:00
practicalswift 211adc074a Use range-based for loops (C++11) when looping over vector elements 2017-05-19 09:56:16 +02:00
Wladimir J. van der Laan ea6fde3f1d
Merge #8329: Consensus: MOVEONLY: Move functions for tx verification
618d07f MOVEONLY: tx functions to consensus/tx_verify.o (Jorge Timón)

Tree-SHA512: 63fa2777c070a344dbfe61974526a770d962e049881c6f371b0034b1682c1e6e24f47454f01ee35ded20ade34488e023d4467a05369662906b99a73bb5de8497
2017-05-18 21:01:49 +02:00
Jonas Schnelli 962cd3f058
Merge #9697: [Qt] simple fee bumper with user verification
a38783747 Make sure we re-check the conditions of a feebump during commit (Jonas Schnelli)
9b9ca538c Only update the transactionrecord if the fee bump has been commited (Jonas Schnelli)
6ed4368f1 Make sure we use nTxConfirmTarget during Qt fee bumps (Jonas Schnelli)
be08fc39d Make sure we always update the table row after a bumpfee call (Jonas Schnelli)
2678d3dc6 Show old-fee, increase a new-fee in Qt fee bumper confirmation dialog (Jonas Schnelli)
2ec911f60 Add cs_wallet lock assertion to SignTransaction() (Jonas Schnelli)
fbf385cc8 [Qt] simple fee bumper with user verification (Jonas Schnelli)

Tree-SHA512: a3ce626201abf64cee496dd1d83870de51ba633de40c48eb0219c3eba5085c038af34c284512130d2544de20c1bff9fea1b78f92e3574c21dd4e96c11b8e7d76
2017-05-18 11:18:23 +02:00
Russell Yanofsky 108f04f2d9 Add missing LOCK2 in CWallet::GetAvailableBalance 2017-05-17 05:18:25 -04:00
Russell Yanofsky 429aa9eb51 [test] Move some tests from qt -> wallet
After previous refactoring, the tests make more sense here.
2017-05-17 05:18:25 -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
Wladimir J. van der Laan 08ac35a7e3
Merge #10413: Fix docs (there's no rpc command setpaytxfee)
0f1b26a Fix docs (there's no rpc command setpaytxfee) (Ryan Havar)

Tree-SHA512: 5b9e1f16e172e712452873f82faa35f3ac949cd1df6e2ee7e2282fc8fad4eaf4548ebf05407426547ad859360ae837172e6343d66f8d302c7f5b097f39bb3994
2017-05-17 10:46:24 +02:00
Pedro Branco bc63d0ed3b Add query options to listunspent rpc call 2017-05-17 08:37:34 +02:00
Ryan Havar 0f1b26a5aa Fix docs (there's no rpc command setpaytxfee) 2017-05-16 21:13:40 -05:00
Russell Yanofsky 2a8e35a11d Fix importwallet edge case rescan bug
Start importwallet rescans at the first block with timestamp greater or equal
to the wallet birthday instead of the last block with timestamp less or equal.
This fixes an edge case bug where importwallet could fail to start the rescan
early enough if there are blocks with decreasing timestamps or multiple blocks
with the same timestamp.
2017-05-16 11:34:28 -04:00
Russell Yanofsky 4d2d6045a4 Fix importmulti failure to return rescan errors
An off-by-one-block bug in importmulti rescan logic could cause it to return
success in an edge case even when a rescan was not successful. The case where
this would happen is if there were multiple blocks in a row with the same
GetBlockTimeMax() value, and the last block was scanned successfully, but one
or more of the earlier blocks was not readable.
2017-05-15 09:11:03 -04:00
Gregory Sanders 091a9ae21c remove minimum total fee option 2017-05-11 22:28:46 -04:00
Wladimir J. van der Laan 94e52273f3
Merge #10308: [wallet] Securely erase potentially sensitive keys/values
6c914ac [wallet] Securely erase potentially sensitive keys/values (Thomas Snider)

Tree-SHA512: 071d88c4093108d4e4eced35a6ffcebe3f499798194f5b1be661ffa5b78b5f55311667f6d2a72758d85290f61f958381ee95d380b9045ca18e9e1875f0e686c8
2017-05-11 19:57:33 +02:00
Wladimir J. van der Laan 18c9debe60
Merge #10341: rpc/wallet: Workaround older UniValue which returns a std::string temporary for get_str
a637734 rpc/wallet: Workaround older UniValue which returns a std::string temporary for get_str (Luke Dashjr)

Tree-SHA512: 8f03f1d301f714f700bf64e259a1c986136fd1ac532f091aa97198a39c131290c320094f4fc38c774c8db4469a75437596b1d933300e4f04037abc158a252bad
2017-05-11 19:19:30 +02:00
Jonas Schnelli a38783747b
Make sure we re-check the conditions of a feebump during commit 2017-05-11 15:27:06 +02:00
Jonas Schnelli 2ec911f60d
Add cs_wallet lock assertion to SignTransaction() 2017-05-11 15:27:05 +02:00
Luke Dashjr a637734ba2 rpc/wallet: Workaround older UniValue which returns a std::string temporary for get_str 2017-05-05 00:21:00 +00:00
Thomas Snider 6c914ac176 [wallet] Securely erase potentially sensitive keys/values 2017-05-03 11:35:51 -07: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
Jorge Timón 330bb5a456
Consensus: Minimal way to move dust out of consensus 2017-05-03 17:55:52 +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
Wladimir J. van der Laan e7b90f78f5
Merge #10180: [trivial] Fix typos (tempoarily → temporarily, inadvertantly → inadvertently)
66082e0 [trivial] Fix typos (tempoarily → temporarily, inadvertantly → inadvertently) (practicalswift)

Tree-SHA512: f377c379c9b6702894289c96fa50e64da01fa4e9353f8507ec5f1f58b0f3047fffdc473dffca61774f57793b82cf9e1c9b5f3d9a04fb864ccc1f44fc2a711f32
2017-05-02 14:49:04 +02:00
Gregory Sanders 7c588637d4 [Wallet] unset change position when there is no change on exact match 2017-05-01 08:07:09 -04:00
Wladimir J. van der Laan 4c924011f5
Merge #10075: Remove unused C++ code not covered by unit tests
b51aaf1 Remove unused C++ code not covered by unit tests (practicalswift)

Tree-SHA512: 267bbd87df01a296bf23e82a8b6ee968e13e23a6aaecc535d803890a3e3e9f6208c7fc4c1f97afd98ed3e498b12fe1ada7e3cb2977ad12359a813f57336c74e5
2017-04-27 20:25:15 +02:00
Alex Morcos 3edbd79a65 cleanup: reduce to one GetMinimumFee call signature 2017-04-26 15:54:23 -04:00
practicalswift b51aaf1c42 Remove unused C++ code not covered by unit tests 2017-04-26 21:20:02 +02: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 c29a0d4812
Merge #10265: [wallet] [moveonly] Check non-null pindex before potentially referencing
c36ea69 [wallet] Make sure pindex is non-null before possibly referencing in LogPrintf call. (Karl-Johan Alm)

Tree-SHA512: a14c9f3e1228bca91977bea821c56a377d80889b41d250050c9be67aa93e460319a7cf1d4b63ee40f23b5a34159590f0e3fe15dc88698dc694c0c8098bd2db4d
2017-04-25 16:04:23 +02:00
Karl-Johan Alm c36ea693ee
[wallet] Make sure pindex is non-null before possibly referencing in LogPrintf call. 2017-04-25 16:18:52 +09: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 342b9bc390
Merge #9792: FastRandomContext improvements and switch to ChaCha20
4fd2d2f Add a FastRandomContext::randrange and use it (Pieter Wuille)
1632922 Switch FastRandomContext to ChaCha20 (Pieter Wuille)
e04326f Add ChaCha20 (Pieter Wuille)
663fbae FastRandom benchmark (Pieter Wuille)
c21cbe6 Introduce FastRandomContext::randbool() (Pieter Wuille)

Tree-SHA512: 7fff61e3f6d6dc6ac846ca643d877b377db609646dd401a0e8f50b052c6b9bcd2f5fc34de6bbf28f04afd1724f6279ee163ead5f37d724fb782a00239f35db1d
2017-04-24 14:28:49 +02:00
Wladimir J. van der Laan 911a4808fb wallet: Add comment describing the various classes in walletdb.h 2017-04-21 16:04:26 +02:00
Wladimir J. van der Laan 86ea3c2ff2
Merge #10181: Include cleanup
1c897fc Missing includes (Jorge Timón)
a1fd450 Trivial: Remove unneeded includes from .h: (Jorge Timón)

Tree-SHA512: ada3e62cc2435e58172a88b380be371b717a05725956c15e5493b6e19fe2903e5e6e43fd22dc24699333a0e8a0c7b42eb1ae61b41cb4ba82495be18e2d4ef3c6
2017-04-20 23:24:00 +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 69d2e9ba67 wallet: Make IsDummy private in CWalletDBWrapper
This is only for use in the low-level functions, and CDB is already
a friend class.
2017-04-20 17:55:01 +02:00
Wladimir J. van der Laan 33232810dc wallet: CWalletDB CDB composition not inheritance
CWalletDB now contains a CDB instead of inheriting from it.

This makes it easier to replace the internal transaction with a different
database, without leaking through internals.
2017-04-20 17:55:01 +02:00
Wladimir J. van der Laan be9e1a968d wallet: Reduce references to global bitdb environment 2017-04-20 17:15:31 +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
Wladimir J. van der Laan c91ca0ace9
Merge #9827: Improve ScanForWalletTransactions return value
30abce7 Improve ScanForWalletTransactions return value (Russell Yanofsky)

Tree-SHA512: 195028553b103052a842b6a37e67410118a20c32475b80f7fd22d6d8622f92eca1c2d84f291d1092bef2161d3187d91052799b533e1e265b7613d51955490b8d
2017-04-19 12:30:02 +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 64c45aada7
Merge #10226: wallet: Use boost to more portably ensure -wallet specifies only a filename
a4186dd wallet: Use boost to more portably ensure -wallet specifies only a filename (Luke Dashjr)

Tree-SHA512: 6dfde31fa599638e5ec76489363e2fed97403be3e5762e4560dfc6ac261ce169a92b5a1b92bb34a893cc898e6073c81f74f49528e8df07e86273ddb37dd1ce80
2017-04-19 10:55:13 +02:00
Luke Dashjr a4186dd239 wallet: Use boost to more portably ensure -wallet specifies only a filename 2017-04-18 15:39:16 +00: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 9141622a0f
[rpc] Add abortrescan command to RPC interface. 2017-04-18 11:41:46 +09:00
MarcoFalke 50a1cc0f0a
Merge #10207: Clarify importprivkey help text ... example of blank label without rescan
c9e31c3 Clarify importprivkey help text with example of blank label without rescan Occasionally I waste a lot of time not remembering that the second parameter to importprivkey must be blank if you intend to stop rescan with "false" as the third parameter. (Warren Togami)

Tree-SHA512: 23781e1d6fd59a9d06d6e12ad10e8ed6641947b3e4a1f66c8fdb5d44cbd8f291e8f2a5e686aa9f9ba5e4bab8ca688caa17244e837f651546055ddf7cc8e7df8f
2017-04-17 22:11:03 +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
Warren Togami c9e31c36ff Clarify importprivkey help text with example of blank label without rescan
Occasionally I waste a lot of time not remembering that the second parameter to importprivkey must be blank if you intend to stop rescan with "false" as the third parameter.
2017-04-13 20:11:42 -07: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
aideca 9f82134779 Add friendly output to dumpwallet refs #9564 2017-04-13 08:39:07 +00:00
NicolasDorier c37e32af0d [Wallet] Prevent CInputCoin to be in a null state 2017-04-13 05:32:24 +00:00
NicolasDorier f597dcb7c8 [Wallet] Simplify code using CInputCoin 2017-04-13 05:31:08 +00:00
NicolasDorier e78bc45810 [Wallet] Decouple CInputCoin from CWalletTx 2017-04-13 05:30:52 +00:00
Jorge Timón 1c897fc3da
Missing includes 2017-04-13 02:31:44 +02:00
John Newbery d0cd0bd6d9 Make CWallet::SyncTransactions() interface friendlier 2017-04-11 17:17:46 -04:00
John Newbery 714e4ad13d AddToWalletIfInvolvingMe should test pIndex, not posInBlock 2017-04-11 10:23:32 -04:00
practicalswift 66082e0119 [trivial] Fix typos (tempoarily → temporarily, inadvertantly → inadvertently) 2017-04-10 22:44:57 +02: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
Wladimir J. van der Laan e183ea2047
Merge #10164: Wallet: reduce excess logic InMempool()
3491476 Wallet: reduce excess logic InMemPool() (Kewde)

Tree-SHA512: 554ea2827cfd482281fae0ba3d0a7989dbfeace98a35462732ea08bf3cc94c9564a9ea8ca2fa9905b963367d0b56a490ef0d83ceb6731c8f06187de98b6a7f23
2017-04-10 15:27:34 +02:00
NicolasDorier fd44ac1e8b [Wallet] Rename std::pair<const CWalletTx*, unsigned int> to CInputCoin 2017-04-08 03:50:14 +00:00
practicalswift bcca57eff0 [trivial] Fix typo ("improssible" → "impossible") 2017-04-07 18:29:54 +02:00
Wladimir J. van der Laan a5fd746674
Merge #9681: Refactor Bumpfee, move core functionality to CWallet
5f59d3e Improve CFeeBumper interface, add comments, make use of std::move (Jonas Schnelli)
0df22ed Cancel feebump is vErrors is not empty (Jonas Schnelli)
44cabe6 Use static calls for GetRequiredFee and GetMinimumFee, remove make_pair from emplace_back (Jonas Schnelli)
bb78c15 Restore CalculateMaximumSignedTxSize function signature (Jonas Schnelli)
51ea44f Use "return false" instead assert() in CWallet::SignTransaction (Jonas Schnelli)
bcc72cc Directly abort execution in FeeBumper::commit if wallet or tx is not available (Jonas Schnelli)
2718db0 Restore invalid fee check (must be > 0) (Jonas Schnelli)
0337a39 Refactor Bumpfee core functionality (Jonas Schnelli)
d1a95e8 Bumpfee move request parameter interaction to the top (Jonas Schnelli)

Tree-SHA512: 0e6d1f3322ed671fa2291e59ac9556ce4646bc78267edc6eedc46b0014b7b08aa83c30315358b911d82898847d4845634a18b67e253a7b699dcc852eb2652c07
2017-04-07 15:51:26 +02: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 e6d5e6cbbe Hold cs_wallet for whole block [dis]connection processing
This simplifies fixing the wallet-returns-stale-info issue as we
now hold cs_wallet across an entire block instead of only per-tx.
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
Kewde 3491476b6f Wallet: reduce excess logic InMemPool()
removed the excess logic, return directly instead of using if-statement.
2017-04-07 00:53:12 +00:00
Jorge Timón 618d07faa2
MOVEONLY: tx functions to consensus/tx_verify.o
Functions related to transaction verification.
2017-04-06 23:36:46 +02:00
Wladimir J. van der Laan 2a5f574762 Use fsbridge for fopen and freopen
Abstracts away how a path is opened to a `FILE*`.

Reduces the number of places where path is converted to a string
for anything else but printing.
2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan bac5c9cf64 Replace uses of boost::filesystem with fs
Step two in abstracting away boost::filesystem.

To repeat this, simply run:
```
git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g'
```
2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan 7d5172d354 Replace includes of boost/filesystem.h with fs.h
This is step one in abstracting the use of boost::filesystem.
2017-04-03 12:32:32 +02:00
Jonas Schnelli 5f59d3ecb7
Improve CFeeBumper interface, add comments, make use of std::move 2017-04-02 10:12:43 +02:00
Jonas Schnelli 0df22ed6fd
Cancel feebump is vErrors is not empty 2017-04-02 10:12:43 +02:00
Jonas Schnelli 44cabe6380
Use static calls for GetRequiredFee and GetMinimumFee, remove make_pair from emplace_back 2017-04-02 10:12:43 +02:00
Jonas Schnelli bb78c1599e
Restore CalculateMaximumSignedTxSize function signature 2017-04-02 10:12:43 +02:00
Jonas Schnelli 51ea44f01c
Use "return false" instead assert() in CWallet::SignTransaction 2017-04-02 10:12:43 +02:00
Jonas Schnelli bcc72cccc7
Directly abort execution in FeeBumper::commit if wallet or tx is not available 2017-04-02 10:12:42 +02:00
Jonas Schnelli 2718db0705
Restore invalid fee check (must be > 0) 2017-04-02 10:12:42 +02:00
Jonas Schnelli 0337a39d31
Refactor Bumpfee core functionality 2017-04-02 10:12:39 +02:00
Jonas Schnelli d1a95e8d3d
Bumpfee move request parameter interaction to the top 2017-04-02 09:48:48 +02:00
Gregory Maxwell 6b3bb3d9ba Change LogAcceptCategory to use uint32_t rather than sets of strings.
This changes the logging categories to boolean flags instead of strings.

This simplifies the acceptance testing by avoiding accessing a scoped
 static thread local pointer to a thread local set of strings.  It
 eliminates the only use of boost::thread_specific_ptr outside of
 lockorder debugging.

This change allows log entries to be directed to multiple categories
 and makes it easy to change the logging flags at runtime (e.g. via
 an RPC, though that isn't done by this commit.)

It also eliminates the fDebug global.

Configuration of unknown logging categories now produces a warning.
2017-04-01 18:53:29 +00:00
Wladimir J. van der Laan f34cdcbd80
Merge #9294: Use internal HD chain for change outputs (hd split)
4115af7 Fix rebase issue where pwalletMain was used instead of pwallet Ser./Deser. nInternalChainCounter as last element (Jonas Schnelli)
9382f04 Do not break backward compatibility during wallet encryption (Jonas Schnelli)
1df08d1 Add assertion for CanSupportFeature(FEATURE_HD_SPLIT) (Jonas Schnelli)
cd468d0 Define CWallet::DeriveNewChildKey() as private (Jonas Schnelli)
ed79e4f Optimize GetOldestKeyPoolTime(), return as soon as we have both oldest keys (Jonas Schnelli)
771a304 Make sure we set the wallets min version to FEATURE_HD_SPLIT at the very first point (Jonas Schnelli)
1b3b5c6 Slightly modify fundrawtransaction.py test (change getnewaddress() into getrawchangeaddress()) (Jonas Schnelli)
003e197 Remove FEATURE_HD_SPLIT bump TODO (Jonas Schnelli)
d9638e5 Overhaul the internal/external key derive switch (Jonas Schnelli)
1090502 Fix superfluous cast and code style nits in RPC wallet-hd.py test (Jonas Schnelli)
58e1483 CKeyPool avoid "catch (...)" in SerializationOp (Jonas Schnelli)
e138876 Only show keypoolsize_hd_internal if HD split is enabled (Jonas Schnelli)
add38d9 GetOldestKeyPoolTime: if HD & HD Chain Split is enabled, response max(oldest-internal-key, oldest-external-key) (Jonas Schnelli)
dd526c2 Don't switch to HD-chain-split during wallet encryption of non HD-chain-split wallets (Jonas Schnelli)
79df9df Switch to 100% for the HD internal keypool size (Jonas Schnelli)
bcafca1 Make sure we always generate one keypool key at minimum (Jonas Schnelli)
d0a627a Fix issue where CDataStream->nVersion was taken a CKeyPool record version (Jonas Schnelli)
9af8f00 Make sure we hand out keypool keys if HD_SPLIT is not enabled (Jonas Schnelli)
469a47b Make sure ReserveKeyFromKeyPool only hands out internal keys if HD_SPLIT is supported (Jonas Schnelli)
05a9b49 Fix wrong keypool internal size in RPC getwalletinfo help (Jonas Schnelli)
01de822 Removed redundant IsLocked() check in NewKeyPool() (Jonas Schnelli)
d59531d Immediately return setKeyPool's size if HD or HD_SPLIT is disabled or not supported (Jonas Schnelli)
02592f4 [Wallet] split the keypool in an internal and external part (Jonas Schnelli)

Tree-SHA512: 80d355d5e844b48c3163b56c788ab8b5b5285db0ceeb19858a3ef517d5a702afeca21dbae526d7b8fb4101c2a745af1d92bf557c40cf516780f17992bf678c1a
2017-03-29 12:51:06 +02:00
Pieter Wuille c21cbe61c6 Introduce FastRandomContext::randbool() 2017-03-29 00:40:17 -07:00
Ryan Havar 53351321c4 ApproximateBestSubset should take inputs by reference, not value 2017-03-28 12:11:44 -06:00
Jonas Schnelli 4115af7ac7
Fix rebase issue where pwalletMain was used instead of pwallet
Ser./Deser. nInternalChainCounter as last element
2017-03-28 09:18:20 +02:00
Jonas Schnelli 9382f0425e
Do not break backward compatibility during wallet encryption 2017-03-27 09:51:55 +02:00
Jonas Schnelli 1df08d1580
Add assertion for CanSupportFeature(FEATURE_HD_SPLIT) 2017-03-24 10:57:55 +01:00
Jonas Schnelli cd468d07d5
Define CWallet::DeriveNewChildKey() as private 2017-03-24 10:57:31 +01:00
Jonas Schnelli ed79e4f497
Optimize GetOldestKeyPoolTime(), return as soon as we have both oldest keys 2017-03-24 10:54:48 +01:00
Jonas Schnelli 771a304ffe
Make sure we set the wallets min version to FEATURE_HD_SPLIT at the very first point 2017-03-24 10:53:35 +01:00
Jonas Schnelli 003e197498
Remove FEATURE_HD_SPLIT bump TODO 2017-03-24 10:28:40 +01:00
Jonas Schnelli d9638e5aa4
Overhaul the internal/external key derive switch 2017-03-24 10:28:40 +01:00
Jonas Schnelli 1090502c3e
Fix superfluous cast and code style nits in RPC wallet-hd.py test 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 e138876f0a
Only show keypoolsize_hd_internal if HD split is enabled 2017-03-24 10:28:40 +01:00
Jonas Schnelli add38d9b83
GetOldestKeyPoolTime: if HD & HD Chain Split is enabled, response max(oldest-internal-key, oldest-external-key) 2017-03-24 10:28:39 +01:00
Jonas Schnelli dd526c2a2d
Don't switch to HD-chain-split during wallet encryption of non HD-chain-split wallets 2017-03-24 10:28:39 +01:00
Jonas Schnelli 79df9df348
Switch to 100% for the HD internal keypool size 2017-03-24 10:28:39 +01:00
Jonas Schnelli bcafca1077
Make sure we always generate one keypool key at minimum 2017-03-24 10:28:39 +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 9af8f00a75
Make sure we hand out keypool keys if HD_SPLIT is not enabled 2017-03-24 10:28:38 +01:00
Jonas Schnelli 469a47b760
Make sure ReserveKeyFromKeyPool only hands out internal keys if HD_SPLIT is supported 2017-03-24 10:28:38 +01:00
Jonas Schnelli 05a9b493eb
Fix wrong keypool internal size in RPC getwalletinfo help 2017-03-24 10:28:38 +01:00
Jonas Schnelli 01de822c8d
Removed redundant IsLocked() check in NewKeyPool() 2017-03-24 10:28:38 +01:00
Jonas Schnelli d59531ddfc
Immediately return setKeyPool's size if HD or HD_SPLIT is disabled or not supported 2017-03-24 10:28:37 +01:00
Jonas Schnelli 02592f4c5e
[Wallet] split the keypool in an internal and external part 2017-03-24 10:28:37 +01:00
Pavel Janík d7f80b6dcb Rename first iterator to prevent shadowing. 2017-03-18 07:59:51 +01:00
Wladimir J. van der Laan 3d857f307b
Merge #9818: Save watch only key timestamps when reimporting keys
7759aa2 Save watch only key timestamps when reimporting keys (Russell Yanofsky)

Tree-SHA512: 433b5a78e5626fb2f3166e6c84c22eabd5239d451dc82694da95af237e034612a24f1a8bc959b7d2f2e576ce0b679be1fa4af929ebfae758c7e832056ab67061
2017-03-17 21:52:14 +01:00
Jonas Schnelli 9c7b7cf0bb
Merge #9592: [Qt] Add checkbox in the GUI to opt-in to RBF when creating a transaction
c4e4792 [Qt] Change RBF checkbox to reflect -walletrbf setting (Russell Yanofsky)
838a58e [Qt] Add simple optin-RBF checkbox and confirmation info (Jonas Schnelli)
568c05a Allow to opt-into RBF when creating a transaction (Jonas Schnelli)

Tree-SHA512: 3d52dcd4e44da8aed4d631748074afef78d38c860f2a8b95323f4801a989d6599a3498a753fc10daba4098c527ef5a0eb942e5b3f1bfd656e1a6bd272b8e6c57
2017-03-17 15:31:52 +01:00
Patrick Strateman fb6f90a4ce Initialize nRelockTime 2017-03-14 15:48:08 -07:00
NicolasDorier dcf2112de6 Add safe flag to listunspent result 2017-03-10 05:11:10 +00: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
Wladimir J. van der Laan c71f0ca5f8
Merge #9960: Trivial: Add const modifier to GetHDChain and IsHDEnabled
3cef950 Trivial: Add const modifier to GetHDChain and IsHDEnabled (NicolasDorier)

Tree-SHA512: 73126689e179d70e6823950b51aae4da0a1e348436bc72338814f3afeec27868bb479d9e8261f86e4fe851e84492778a30c5f1fe76c9d7dd91796d0e38baeaf0
2017-03-09 10:27:31 +01:00
Wladimir J. van der Laan 02bd6e9bc6
Merge #9853: Fix error codes from various RPCs
adaa281 Update release notes to include RPC error code changes. (John Newbery)
338bf06 Add commenting around JSON error codes (John Newbery)
dab804c Return correct error codes in fundrawtransaction(). (John Newbery)
a012087 Return correct error codes in setban(). (John Newbery)
960bc7f Return correct error codes in removeprunedfunds(). (John Newbery)
c119096 Return correct error codes in blockchain.cpp. (John Newbery)
6d07c62 Return correct error codes in bumpfee(). (John Newbery)

Tree-SHA512: 4bb39ad221cd8c83d98ac5d7ad642f3a8c265522720dc86b2eebc70e74439a85b06d6ddcd6a874e879d986511de3ab0878bb7fe58b50cb0546b78913632ea809
2017-03-09 10:02:17 +01:00
NicolasDorier 3cef95058c Trivial: Add const modifier to GetHDChain and IsHDEnabled 2017-03-09 11:32:02 +09:00
Karl-Johan Alm 8a5228197c
Refactor: Remove using namespace <xxx> from wallet/ 2017-03-08 08:46:59 -08:00
MarcoFalke 8bfa13b15b
Merge #9936: [trivial] Fix three typos introduced into walletdb.h in commit 7184e25
fdab309 [trivial] Fix typos introduced in 7184e25c80 (practicalswift)

Tree-SHA512: 091666f996267fc5d9f911e6ff25051df5c198851a9c2a6cae73692ffacc64f4275932260487aa48a224ca7f80c58f79933065c72d42aeccae540293c67bcee9
2017-03-08 14:15:47 +01:00
John Newbery dab804c18a Return correct error codes in fundrawtransaction().
The fundrawtransaction() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when funding the transaction
failed). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

That error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05:00
John Newbery 960bc7f778 Return correct error codes in removeprunedfunds().
The removeprunedfunds() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when the transaction was
not found in the wallet). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

This error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05:00
John Newbery 6d07c62322 Return correct error codes in bumpfee().
The bumpfee() RPC was returning misleading or incorrect error codes
(for example RPC_INVALID_ADDRESS_OR_KEY when the transaction was not
BIP125 replacable). This commit fixes those error codes:

- RPC_INVALID_ADDRESS_OR_KEY if an invalid address was provided:
    - Invalid change address given
- RPC_INVALID_PARAMETER if a single (non-address/key) parameter is incorrect
    - confTarget and totalFee options should not both be set.
    - Invalid confTarget
    - Insufficient totalFee (cannot be less than required fee)
- RPC_WALLET_ERROR for any other error
    - Transaction has descendants in the wallet
    - Transaction has descendants in the mempool
    - Transaction has been mined, or is conflicted with a mined transaction
    - Transaction is not BIP 125 replaceable
    - Transaction has already been bumped
    - Transaction contains inputs that don't belong to the wallet
    - Transaction has multiple change outputs
    - Transaction does not have a change output
    - Fee is higher than maxTxFee
    - New fee rate is less than the minimum fee rate
    - Change output is too small.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05: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
practicalswift fdab309670 [trivial] Fix typos introduced in 7184e25c80 2017-03-07 09:16:46 +01:00
Matt Corallo 0235be1e7a Rename FlushWalletDB -> CompactWalletDB, add function description 2017-03-06 18:35:20 -05: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
Jonas Schnelli 7184e25c80
[Wallet] refactor CWallet/CWalletDB/CDB
Try to hide CDB/bitdb behinde CWalletDB.
Prepare for full wallet database abstraction.
2017-03-06 11:30:24 +01: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
Wladimir J. van der Laan 5a6af31722
Merge #9908: Define 7200 second timestamp window constant
e57a1fd Define 7200 second timestamp window constant (Russell Yanofsky)

Tree-SHA512: 449d20e4fd23905cd96be36f717c55a0a2360aba1002aaf55a3699cce4a41f6e94acc2fbe511a93c5cbe8f8e68386995a76cad67620ebb66ba9283e6080ab567
2017-03-06 10:02:05 +01:00
Wladimir J. van der Laan 56ab672b59
Merge #9576: [wallet] Remove redundant initialization
343ba8f [wallet] Remove redundant initialization (practicalswift)

Tree-SHA512: 54b94d7703b1735cb1ae0bd7eba61ca9d2f18e20b70e46c94aa3b0653495dce4fdea00cf953ec08215b96b5792eabb8b38c3f9b3cd36e52b82fcb2f1fd8a3540
2017-03-06 09:40:06 +01:00
Alex Morcos 359e8a03d1 [cleanup] Remove coin age priority completely.
Remove GetPriority and ComputePriority.  Remove internal machinery for tracking priority in CTxMemPoolEntry.
2017-03-03 16:50:20 -05:00
Alex Morcos f838005444 No longer allow "free" transactions
Remove -limitfreerelay and always enforce minRelayTxFee in the mempool (except from disconnected blocks)

Remove -relaypriority, the option was only used for the ability to allow free transactions to be relayed regardless of their priority.  Both notions no longer apply.
2017-03-03 16:50:19 -05:00
Russell Yanofsky e57a1fd899 Define 7200 second timestamp window constant 2017-03-03 13:51:41 -05:00
Russell Yanofsky 7759aa23d1 Save watch only key timestamps when reimporting keys
Previously if an existing watch only key was reimported with a new timestamp,
the new timestamp would not be saved in the key metadata, and would not be used
to update the wallet nTimeFirstKey value (which could cause rescanning to start
at the wrong point and miss transactions).

Issue was pointed out by Jonas Schnelli <dev@jonasschnelli.ch> in
https://github.com/bitcoin/bitcoin/pull/9108#issuecomment-279715550
2017-03-03 11:22:44 -05:00
Russell Yanofsky 630fc549e2 Clean up braces in CWallet::ComputeTimeSmart 2017-03-03 11:22:44 -05: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
Russell Yanofsky c6b82d1db5 Add tests for CWalletTx::nTimeSmart 2017-03-03 11:22:44 -05:00
Wladimir J. van der Laan 67c5cc1917
Merge #9828: Avoid -Wshadow warnings in wallet_tests
09fe346 Avoid -Wshadow warnings in wallet_tests (Russell Yanofsky)

Tree-SHA512: 03a026787438efc9eba94299c2dd7de07a71ec7363b058b4f086d5ff0be844660fff2ef4f40e43d91313ea53de25f3de3c677b080b564d37f0693057498d3233
2017-03-03 16:08:50 +01:00
Wladimir J. van der Laan 75d012e8c7
Merge #8808: Do not shadow variables (gcc set)
ad1ae7a Check and enable -Wshadow by default. (Pavel Janík)
9de90bb Do not shadow variables (gcc set) (Pavel Janík)

Tree-SHA512: 9517feb423dc8ddd63896016b25324673bfbe0bffa97f22996f59d7a3fcbdc2ebf2e43ac02bc067546f54e293e9b2f2514be145f867321e9031f895c063d9fb8
2017-03-03 15:48:53 +01:00
Wladimir J. van der Laan eb281842b7
Merge #8775: RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest
d678771 Wallet: Sanitise -wallet parameter (Luke Dashjr)
9756be3 Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name (Luke Dashjr)
86be48a More tightly couple EnsureWalletIsAvailable with GetWalletForJSONRPCRequest where appropriate (Luke Dashjr)
a435632 Move wallet RPC declarations to rpcwallet.h (Luke Dashjr)
ad15734 RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method (Luke Dashjr)
bf8a04a Reformat touched lines with C++11 (Luke Dashjr)
2e518e3 Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet (Luke Dashjr)
d77ad6d RPC: Do all wallet access through new GetWalletForJSONRPCRequest (Luke Dashjr)
eca550f RPC/Wallet: Pass CWallet as pointer to helper functions (Luke Dashjr)

Tree-SHA512: bfd592da841693390e16f83b451503eb5cedb71208089aa32b3fc45e973555584a3ed7696dd239f6409324464d565dacf0f3d0e36e8e13ae6a7843848465f960
2017-03-03 13:38:42 +01:00
MarcoFalke f7ec7cfd38
Merge #9359: Add test for CWalletTx::GetImmatureCredit() returning stale values.
7ed143c Add test for CWalletTx::GetImmatureCredit() returning stale values. (Russell Yanofsky)

Tree-SHA512: c95088ed6dfc5a0774ddaa2fe14ac0a9ebd830922a4d77100ec3d51fdeb6df40ad97de4f2ea970ed0f4122dcc0022ee1d43ab3c7188becd7f90c1c6af0ed39b7
2017-03-02 22:30:15 +01:00
Wladimir J. van der Laan 65d90f585a
Merge #9143: Refactor ZapWalletTxes to avoid layer violations
0165a56 Refactor ZapWalletTxes to avoid layer vialotions (Jonas Schnelli)

Tree-SHA512: 51e3abbb866185817d14d685a65cb1070a7a60aa3db692670f3a5fdd328aad59afa765c5a6b13d9e8f6d219e735487f8c87998f2fb38fdd911c1fe19bea373b9
2017-03-02 11:32:34 +01:00
Russell Yanofsky 30abce7a99 Improve ScanForWalletTransactions return value
Change ScanForWalletTransactions return value so it is possible to distinguish
scans that skip reading every block (due to the nTimeFirstKey optimization)
from scans that fail while reading the chainActive.Tip() block. Return value is
now non-null in the non-failing case.

This change doesn't affect any user-visible behavior, it is only an internal
API improvement. The only code currently using the ScanForWalletTransactions
return value is in importmulti, and importmulti always calls
ScanForWalletTransactions with a pindex pointing to the first block in
chainActive whose block time is >= (nLowestTimestamp - 7200), while
ScanForWalletTransactions would only return null without reading blocks when
pindex and every block after it had a block time < (nTimeFirstKey - 7200).
These conditions could never happen at the same time because nTimeFirstKey <=
nLowestTimestamp.

I'm planning to make a more substantial API improvement in the future (making
ScanForWalletTransactions private and exposing a higher level rescan method to
RPC code), but Matt Corallo <git@bluematt.me> pointed out this odd behavior
introduced by e2e2f4c "Return errors from importmulti if complete rescans are
not successful" yesterday, so I'm following up now to get rid of badness
introduced by that merge.
2017-03-01 05:16:24 -05:00
Russell Yanofsky 7ed143c10e Add test for CWalletTx::GetImmatureCredit() returning stale values.
Add test for cached immature credit flag not being cleared in
CWalletTx::MarkDirty() bug, which was fixed in
https://github.com/bitcoin/bitcoin/pull/8717, commit a560378.
2017-03-01 05:11:46 -05:00
practicalswift 343ba8fef5 [wallet] Remove redundant initialization
Prior to this commit pindexRescan was initialized to a chainActive.Tip().
However, the value of pindexRescan set at time of initialization was never
read before pindexRescan was being set to either chainActive.Genesis()
(case 1), FindForkInGlobalIndex(chainActive, locator) (case 2) or
chainActive.Genesis() (case 3). Thus, the initialization was redundant.

This commit a.) removes the redundant initialization and b.) simplifies
this logic so that pindexRescan is initialized to chainActive.Genesis()
(case 1 and 3), and set to FindForkInGlobalIndex(chainActive, locator)
(case 2) as needed.
2017-02-28 16:54:43 +01:00
Wladimir J. van der Laan 7e2a2212ec
Merge #9829: Fix importmulti returning rescan errors for wrong keys
306bd72 Fix importmulti returning rescan errors for wrong keys (Russell Yanofsky)

Tree-SHA512: ae9998236cbd3ff749d6b5c716bd76c9cec386b0708583e4912e4e05bf4584545258e1d0543aa5445024d2b5decf859a64f40c6503029773366a0f9a9ddf9b88
2017-02-28 13:52:50 +01:00
Wladimir J. van der Laan 30bdcfca2b
Merge #9865: Change bitcoin address in RPC help message
83ac719 Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did). (Marijn Stollenga)

Tree-SHA512: ca1163466a149d567b97efbfcfa8fdfe2d474245b4dd5a1a92555b4e87f8e99df5fee4cd79ef1ce6a98db2337846af78f37c2e6b31d02008b11fa0e151ce6590
2017-02-28 11:59:34 +01:00
Luke Dashjr d678771c66 Wallet: Sanitise -wallet parameter 2017-02-27 20:45:18 +00:00
Luke Dashjr 9756be382e Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name
The job name is logged, and could pose as an information leak to someone attacking the process, helping them counteract ASLR protections
2017-02-27 20:45:18 +00:00
Luke Dashjr 86be48a77c More tightly couple EnsureWalletIsAvailable with GetWalletForJSONRPCRequest where appropriate 2017-02-27 20:45:18 +00:00
Luke Dashjr a4356328e0 Move wallet RPC declarations to rpcwallet.h 2017-02-27 20:45:18 +00:00
Luke Dashjr bf8a04a165 Reformat touched lines with C++11 2017-02-27 20:45:18 +00:00
Luke Dashjr 2e518e313b Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet 2017-02-27 20:45:17 +00:00
Luke Dashjr d77ad6d416 RPC: Do all wallet access through new GetWalletForJSONRPCRequest 2017-02-27 20:45:17 +00:00
Luke Dashjr eca550f250 RPC/Wallet: Pass CWallet as pointer to helper functions 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 306bd72157 Fix importmulti returning rescan errors for wrong keys
Bug was a missing ++i line in a new range for loop added in commit e2e2f4c
"Return errors from importmulti if complete rescans are not successful"
2017-02-27 07:38:51 -05:00
Wladimir J. van der Laan 75a109338f tests: Fix dangling pwalletMain pointer in wallet tests 2017-02-27 13:15:39 +01:00
Marijn Stollenga 83ac719d34 Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did). 2017-02-26 14:01:05 +01:00
Russell Yanofsky f81f0d0030 Update sendfrom RPC help to correct coin selection misconception 2017-02-23 13:44:12 -05:00
Russell Yanofsky 09fe346a4f Avoid -Wshadow warnings in wallet_tests
Warnings introduced by commit e2e2f4c "Return errors from importmulti if
complete rescans are not successful" and reported by Pavel Janík
<Pavel@Janik.cz> in https://github.com/bitcoin/bitcoin/pull/9773 and
https://github.com/bitcoin/bitcoin/pull/9827

wallet/test/wallet_tests.cpp: In member function ‘void wallet_tests::rescan::test_method()’:
wallet/test/wallet_tests.cpp:377:17: warning: declaration of ‘wallet’ shadows a global declaration [-Wshadow]
         CWallet wallet;
2017-02-22 14:11:44 -05:00
Wladimir J. van der Laan ba7220b5e8
Merge #9773: Return errors from importmulti if complete rescans are not successful
e2e2f4c Return errors from importmulti if complete rescans are not successful (Russell Yanofsky)
2017-02-22 12:43:11 +01:00
Wladimir J. van der Laan 5f0556d032
Merge #9727: Remove fallbacks for boost_filesystem < v3
056aba2 Remove fallbacks for boost_filesystem < v3 (Wladimir J. van der Laan)
2017-02-21 17:08:37 +01:00
Wladimir J. van der Laan 2dad02232a
Merge #9760: [wallet] Remove importmulti always-true check
ec1267f [wallet] Remove importmulti always-true check (Russell Yanofsky)
2017-02-20 17:30:07 +01:00
MarcoFalke aa5fa642b0
Merge #9696: [trivial] Fix recently introduced typos in comments
0c9b9b7 [trivial] Fix recently introduced typos in comments (practicalswift)
2017-02-18 12:13:09 +01:00
Russell Yanofsky e2e2f4c856 Return errors from importmulti if complete rescans are not successful 2017-02-17 14:12:31 -05:00
Russell Yanofsky ec1267f13b [wallet] Remove importmulti always-true check
Remove "nLowestTimestamp <= chainActive.Tip()->GetBlockTimeMax()" check from
importmulti, which is always true because nLowestTimestamp is set to the
minimum of the most recent block time and all the imported key timestamps,
which is necessarily lower than the maximum block time.
2017-02-17 07:00:41 -05:00
Russell Yanofsky e662af3583 Use 2 hour grace period for key timestamps in importmulti rescans
Gregory Maxwell <greg@xiph.org> pointed out the lack of grace period in
https://github.com/bitcoin/bitcoin/pull/9490#issue-199407998.

The importwallet RPC which uses key timestamps in a similar way already has a 2
hour grace period.
2017-02-16 09:05:55 -05:00
Wladimir J. van der Laan e43a58514d
Merge #9771: Add missing cs_wallet lock that triggers new lock held assertion
07afcd6 Add missing cs_wallet lock that triggers new lock held assertion (Russell Yanofsky)
2017-02-16 10:30:33 +01:00
Wladimir J. van der Laan f8af89a918
Merge #9764: wallet: Prevent "overrides a member function but is not marked 'override'" warnings
6c5427d wallet: Prevent "overrides a member function but is not marked 'override'" warnings (Wladimir J. van der Laan)
2017-02-16 10:24:24 +01:00
Russell Yanofsky 07afcd6379 Add missing cs_wallet lock that triggers new lock held assertion
A new AssertLockHeld(cs_wallet) call was added in commit a58370e
"Dedup nTimeFirstKey update logic" (part of PR #9108).

The lock held assertion will fail when loading prexisting wallets files from
before the #9108 merge that have watch-only keys.
2017-02-15 17:01:30 -05:00
Wladimir J. van der Laan 7a93af8340
Merge #9756: Return error when importmulti called with invalid address.
9acf25c Return error when importmulti called with invalid address. (Russell Yanofsky)
2017-02-15 16:29:16 +01: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