Commit graph

283 commits

Author SHA1 Message Date
Alex Morcos f61766b37b Make sure conflicted wallet tx's update balances 2016-01-06 17:24:30 -05:00
Murch 96efcadfc0 Improved readability of sorting for coin selection.
Future proofing added lines
2016-01-05 22:03:43 +01:00
Alex Morcos e420a1b15e Add sane fallback for fee estimation
Add new commandline option "-fallbackfee" to use when fee estimation does not have sufficient data.
2016-01-05 13:13:23 -05:00
Alex Morcos 995b9f385b Always respect GetRequiredFee for wallet txs 2016-01-05 13:10:19 -05:00
Wladimir J. van der Laan 605c17844e
Merge pull request #7205
fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke)
fa24439 Bump copyright headers to 2015 (MarcoFalke)
fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
2016-01-05 14:11:40 +01:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
accraze d812daf967 fix logic for error log 2015-12-12 10:45:53 -08:00
accraze c611acc38a wallet: check if tx scriptPubKey is unspendable 2015-12-12 10:33:37 -08:00
accraze b6915b8239 checks for null data transaction before debug.log
CWalletTx::GetAmounts could not find output address for null data transactions, thus issuing an error in debug.log. This change checks to see if the transaction is OP_RETURN before issuing error.

resolves #6142
2015-12-11 18:07:11 -08:00
Wladimir J. van der Laan 00b4b8d1c4
Merge pull request #7154
a3c3ddb [Qt] add InMempool() info to transaction details (Jonas Schnelli)
2015-12-09 10:48:27 +01:00
Murch fc0f52d780 Added a test for the pruning of extraneous inputs after ApproximateBestSet 2015-12-07 20:08:37 +01:00
Murch af9510e037 Moved set reduction to the end of ApproximateBestSubset to reduce performance impact 2015-12-07 17:36:47 +01:00
AlSzacrel 5c03483e26 Coinselection prunes extraneous inputs from ApproximateBestSubset
A further pass over the available inputs has been added to ApproximateBestSubset after a candidate set has been found. It will prune any extraneous inputs in the selected subset, in order to decrease the number of input and the resulting change.
2015-12-06 23:26:45 +01:00
Jonas Schnelli 7d0bf0bb46
include the chaintip *blockIndex in the SyncTransaction signal
- allows reducing of calls to main.cpp for getting the chaintip during transaction syncing
- potentially allows reducing of cs_main locks
2015-12-04 09:18:53 +01:00
MarcoFalke fabd10a9c9 Fix typo in wallet.cpp 2015-12-02 15:21:18 +01:00
Wladimir J. van der Laan 83f06ca937
Merge pull request #6216
db6047d Take the training wheels off anti-fee-sniping (Peter Todd)
2015-12-02 13:56:57 +01:00
Jonas Schnelli a3c3ddbd7b
[Qt] add InMempool() info to transaction details 2015-12-02 08:38:31 +01:00
Wladimir J. van der Laan 9490bd71bd
Merge pull request #7096
ff723da [Qt] improve minimum absolute fee option - Only display the minimum absolute fee control if CoinControl is enabled (Jonas Schnelli)
31b508a [Qt] make use of the nMinimumTotalFee (absolute) in coincontrols fee calculation (Jonas Schnelli)
80462dd [Qt] use ASYMP_UTF8 (≈) whenever we show a fee that is not absolute (Jonas Schnelli)
ecc7c82 Move fPayAtLeastCustomFee function to CC (Pieter Wuille)
2015-12-01 09:59:03 +01:00
Wladimir J. van der Laan 30c2d8c635
Merge pull request #7105
9ac63d6 Keep track of explicit wallet conflicts instead of using mempool (Pieter Wuille)
2015-12-01 09:22:08 +01:00
Pieter Wuille ecc7c82361
Move fPayAtLeastCustomFee function to CC 2015-11-30 14:09:04 +01:00
Pieter Wuille 9ac63d6d30 Keep track of explicit wallet conflicts instead of using mempool 2015-11-29 13:24:02 +01:00
Ryan Havar 4b89f01d72 Default fPayAtLeastCustomFee to false
This allows for much finer control of the transaction fees per kilobyte
as it prevent small transactions using a fee that is more appropriate
for one that is of a kilobyte.

This also allows controlling the fee per kilobyte over rpc such that:

bitcoin-cli settxfee `bitcoin-cli estimatefee 2`

would make sense, while currently it grossly fails often by a factor of x3
2015-11-28 22:51:41 +01:00
MarcoFalke faf93f37fe [trivial] Reuse translation and cleanup DEFAULT_* values
* DEFAULT_DISABLE_SAFEMODE = false
* Use DEFAULT_* constants for extern bools
2015-11-28 19:01:11 +01:00
Luke Dashjr b966aa836a Constrain constant values to a single location in code 2015-11-28 18:47:29 +01:00
Wladimir J. van der Laan e92377fa7f
Merge pull request #6134
e304432 Pass reference to estimateSmartFee and cleanup whitespace (Suhas Daftuar)
56106a3 Expose RPC calls for estimatesmart functions (Alex Morcos)
e93a236 add estimateSmartFee to the unit test (Alex Morcos)
6303051 EstimateSmart functions consider mempool min fee (Alex Morcos)
f22ac4a Increase success threshold for fee estimation to 95% (Alex Morcos)
4fe2823 Change wallet and GUI code to use new smart fee estimation calls. (Alex Morcos)
22eca7d Add smart fee estimation functions (Alex Morcos)
2015-11-27 12:59:37 +01:00
Suhas Daftuar e30443244a Pass reference to estimateSmartFee and cleanup whitespace 2015-11-24 08:53:14 -05:00
Luke Dashjr 3e7c89196c Optimisation: Store transaction list order in memory rather than compute it every need
Huge performance improvement (450%) for zapwallettxes
2015-11-21 01:48:25 +00:00
Alex Morcos 4fe28236c0 Change wallet and GUI code to use new smart fee estimation calls. 2015-11-16 15:33:06 -05:00
Wladimir J. van der Laan 77beab70de
Merge pull request #6163
87cbdb8 Globals: Explicit Consensus::Params arg for main: (Jorge Timón)
2015-11-10 15:32:03 +01:00
Wladimir J. van der Laan 3694b74fa9
Merge pull request #6887
53238ff Clarify what minrelaytxfee does (MarcoFalke)
abd8b76 [qt] Properly display required fee instead of minTxFee (MarcoFalke)
2015-11-05 12:11:11 +01:00
Wladimir J. van der Laan 8a95a18562
Merge pull request #6669
6342a48 Init: Use DEFAULT_TRANSACTION_MINFEE in help message (MarcoFalke)
a9c73a1 [wallet] Add comments for doxygen (MarcoFalke)
6b0e622 [wallet] Refactor to use new MIN_CHANGE (MarcoFalke)
2015-11-04 12:30:50 +01:00
MarcoFalke abd8b768ee [qt] Properly display required fee instead of minTxFee 2015-11-03 08:53:37 +01:00
Jorge Timón 87cbdb8b41 Globals: Explicit Consensus::Params arg for main:
-CheckBlockIndex
-DisconnectTip
-GetTransaction
-InvalidateBlock
-ProcessGetData
-ReadBlockFromDisk
2015-10-30 14:07:30 +01:00
MarcoFalke a9c73a130e [wallet] Add comments for doxygen 2015-10-28 11:15:48 +01:00
MarcoFalke 6b0e622c25 [wallet] Refactor to use new MIN_CHANGE
* Introduce new constant MIN_CHANGE and use it instead of the
hardcoded "CENT"
* Add test case for MIN_CHANGE
* Introduce new constant for -mintxfee default:
  DEFAULT_TRANSACTION_MINFEE = 1000
2015-10-28 10:52:46 +01:00
Matt Corallo d355cf4420 Only call TrimToSize once per reorg/blocks disconnect 2015-10-13 01:39:38 -07:00
Wladimir J. van der Laan 12a7712abd
Merge pull request #5924
835c122 Clean up change computation in CreateTransaction. (Daniel Kraft)
2015-10-01 11:20:08 +02:00
Pieter Wuille 391dff16fe Do not store Merkle branches in the wallet.
Assume that when a wallet transaction has a valid block hash and transaction position
in it, the transaction is actually there. We're already trusting wallet data in a
much more fundamental way anyway.

To prevent backward compatibility issues, a new record is used for storing the
block locator in the wallet. Old wallets will see a wallet file synchronized up
to the genesis block, and rescan automatically.
2015-09-22 18:51:07 +02:00
Wladimir J. van der Laan ddd8d80c63
Merge pull request #6415
d042854 SQUASH "Implement watchonly support in fundrawtransaction" (Matt Corallo)
428a898 SQUASH "Add have-pubkey distinction to ISMINE flags" (Matt Corallo)
6bdb474 Implement watchonly support in fundrawtransaction (Matt Corallo)
f5813bd Add logic to track pubkeys as watch-only, not just scripts (Matt Corallo)
d3354c5 Add have-pubkey distinction to ISMINE flags (Matt Corallo)
5c17059 Update importaddress help to push its use to script-only (Matt Corallo)
a1d7df3 Add importpubkey method to import a watch-only pubkey (Matt Corallo)
907a425 Add p2sh option to importaddress to import redeemScripts (Matt Corallo)
983d2d9 Split up importaddress into helper functions (Matt Corallo)
cfc3dd3 Also remove pay-2-pubkey from watch when adding a priv key (Matt Corallo)
2015-08-14 16:28:37 +02:00
Matt Corallo d04285430d SQUASH "Implement watchonly support in fundrawtransaction" 2015-08-08 09:30:53 -07:00
Wladimir J. van der Laan f18b8ec7cf Make sure LogPrintf strings are line-terminated
Fix the cases where LogPrint[f] was accidentally called without line
terminator, which resulted in concatenated log lines.

(see e.g. #6492)
2015-08-03 17:40:55 +02:00
Jorge Timón 60c8bac77c Includes: Cleanup around net main and wallet
-Move from .h to .cpp: in main, net and wallet
-Remove unnecessary #include "main.h"
-Cleanup some wallet files includes
2015-07-23 21:10:26 +02:00
Jorge Timón 9dd793f499 TRIVIAL: Missing includes 2015-07-23 21:10:22 +02:00
Matt Corallo 6bdb474dc9 Implement watchonly support in fundrawtransaction
Some code and test cases stolen from
Bryan Bishop <bryan@ledgerx.com> (pull #5524).
2015-07-20 16:01:38 -07:00
Matt Corallo cfc3dd3428 Also remove pay-2-pubkey from watch when adding a priv key 2015-07-20 16:01:37 -07:00
Wladimir J. van der Laan 086cb336cd
Merge pull request #6365
5a7304b Move recently introduced CTransAction::IsEquivalentTo to CWalletTx (Wladimir J. van der Laan)
2015-07-06 19:11:14 +02:00
Wladimir J. van der Laan 9546a977d3
Merge pull request #6335
9238ecb Policy: MOVEONLY: 3 functions to policy.o: (Luke Dashjr)
627b9de Policy: MOVEONLY: Create policy/policy.h with some constants (Jorge Timón)
2015-07-06 18:54:20 +02:00
Wladimir J. van der Laan 5a7304b69d Move recently introduced CTransAction::IsEquivalentTo to CWalletTx
CTransAction::IsEquivalentTo was introduced in #5881.
This functionality is only useful to the wallet, and should never have
been added to the primitive transaction type.
2015-07-02 20:57:39 +02:00
Wladimir J. van der Laan 3203a0832a
Merge pull request #5881
5d34e16 Add txn_clone.py test (Tom Harding)
defd2d5 Better txn_doublespend.py test (Tom Harding)
b2b3619 Implement CTransaction::IsEquivalentTo(...) (Tom Harding)
2015-07-02 19:59:50 +02:00
Jonas Schnelli 5496253966 add CReserveScript to allow modular script keeping/returning
- use one CReserveScript per mining thread
2015-07-01 16:06:14 +02:00
Jonas Schnelli 087e65def9 fix GetScriptForMining() CReserveKey::keepKey() issue 2015-06-30 21:45:46 +02:00
Jonas Schnelli d0fc10a844 detach wallet from miner 2015-06-30 21:45:46 +02:00
Jorge Timón 627b9deff4 Policy: MOVEONLY: Create policy/policy.h with some constants 2015-06-26 17:59:07 +02:00
Peter Todd db6047d61b
Take the training wheels off anti-fee-sniping
Now that the off-by-one error w/nLockTime txs issue has been fixed by
87550eef (75a4d512 in the 0.11 branch) we can make the anti-fee-sniping
protection create transactions with nLockTime set such that they're only
valid in the next block, rather than an earlier block.

There was also a concern about poor propagation, however testing with
transactions with nLockTime = GetAdjustedTime()+1 as a proxy for
nLockTime propagation, as well as a few transactions sent the moment
blocks were received, has turned up no detectable issues with
propagation. If you have a block at a given height you certainly have at
least one peer with that block who will accept the transaction. That
peer will certainly have other peers who will accept it, and soon
essentially the whole network has the transaction. In particular, if a
node recives a transaction that it rejects due to the tx being
non-final, it will be accepted again later as it winds its way around
the network.
2015-06-21 23:39:49 -04:00
Matt Corallo 1e0d1a2ff0 Add FundTransaction method to wallet
Some code stolen from Jonas Schnelli <jonas.schnelli@include7.ch>
2015-06-11 01:03:23 -07:00
Wladimir J. van der Laan 12cdbabc26
Merge pull request #6152
08d9373 Remove unused code from wallet and validation interface (Michael Ford)
2015-06-05 21:24:15 +02:00
Philip Kaufmann a9ac95c1bc use const references where appropriate 2015-06-04 19:34:18 +02:00
Wladimir J. van der Laan 87550eefc1
Merge pull request #6183
28bf062 Fix off-by-one error w/ nLockTime in the wallet (Peter Todd)
2015-06-01 11:33:33 +02:00
Wladimir J. van der Laan c7c9af381c
Merge pull request #5669
da29ecb Consensus: MOVEONLY: Move CValidationState from main consensus/validation (jtimon)
27afcd8 Consensus: Refactor: Decouple CValidationState from main::AbortNode() (Cory Fields)
2015-05-27 15:00:02 +02:00
Peter Todd 28bf06236d
Fix off-by-one error w/ nLockTime in the wallet
Previously due to an off-by-one error the wallet ignored
nLockTime-by-height transactions that would be valid in the next block
even though they are accepted into the mempool. The transactions
wouldn't show up until confirmed, nor would they be included in the
unconfirmed balance. Similar to the mempool behavior fix in 665bdd3b,
the wallet code was calling IsFinalTx() directly without taking into
account the fact that doing so tells you if the transaction could have
been mined in the *current* block, rather than the next block.

To fix this we strip IsFinalTx() of non-consensus-critical
functionality, removing the default arguments, and add CheckFinalTx() to
check if a transaction will be final in the next block.
2015-05-27 05:51:33 -04:00
Michael Ford 08d9373e2f Remove unused code from wallet and validation interface
Fixes #6109
2015-05-18 17:11:06 +08:00
Wladimir J. van der Laan 77ed59df4d wallet: Introduce constant for -txconfirmtarget default 2015-05-18 09:00:24 +02:00
jtimon da29ecbcc6 Consensus: MOVEONLY: Move CValidationState from main consensus/validation 2015-05-15 16:05:28 +02:00
Wladimir J. van der Laan 00820f921d
Merge pull request #6055
a8cdaf5 checkpoints: move the checkpoints enable boolean into main (Cory Fields)
11982d3 checkpoints: Decouple checkpoints from Params (Cory Fields)
6996823 checkpoints: make checkpoints a member of CChainParams (Cory Fields)
9f13a10 checkpoints: store mapCheckpoints in CCheckpointData rather than a pointer (Cory Fields)
2015-05-06 11:38:39 +02:00
Wladimir J. van der Laan 00e76db8c2
Merge pull request #6085
b05a89b Non-grammatical language improvements (Luke Dashjr)
7e6d23b Bugfix: Grammar fixes (Corinne Dashjr)
2015-05-04 08:01:58 +02:00
Daniel Kraft 835c12291e Clean up change computation in CreateTransaction.
Compute the change directly as difference between the "requested" and
the actual value returned by SelectCoins.  This removes a duplication of
the fee logic code.
2015-05-03 10:56:48 +02:00
Corinne Dashjr 7e6d23b171 Bugfix: Grammar fixes 2015-05-01 11:21:27 +00:00
Cory Fields 11982d366d checkpoints: Decouple checkpoints from Params
Pass checkpoint data in as necessary
2015-04-30 23:14:48 -04:00
Wladimir J. van der Laan 23c998d811
Merge pull request #5511
e9c3215 [Wallet] sort pending wallet transactions before reaccepting (dexX7)
2015-04-29 09:52:39 +02:00
Wladimir J. van der Laan 1d9d314573
Merge pull request #5696
691161d Consensus: Create consensus/consensus.h with some constants (jtimon)
2015-04-26 14:42:09 +02:00
jtimon 691161d419 Consensus: Create consensus/consensus.h with some constants 2015-04-20 21:27:51 +02:00
Gregory Maxwell 219953ce50 Show zero value txouts in listunspent.
It's reasonable that automatic coin selection will not pick a zero
 value txout, but they're actually  spendable; and you should know
 if you have them. Listing also makes them available to tools like
 dust-b-gone.
2015-04-20 10:13:18 -07:00
Philip Kaufmann c6de7c35bc trivial string change in wallet.cpp (the -> that) 2015-04-20 13:29:23 +02:00
Tom Harding b2b3619262 Implement CTransaction::IsEquivalentTo(...)
Define CTransaction::IsEquivalentTo(const CTransaction& tx)

True if only scriptSigs are different.  In other words, true if
the two transactions are malleability clones.  In other words,
true if the two transactions have the same effect on the
outside universe.

In the wallet, only SyncMetaData for equivalent transactions.
2015-04-11 19:03:58 -07:00
Wladimir J. van der Laan 6f252627b2 wallet: make it possible to disable transaction broadcast
This is an advanced feature which will disable any kind of automatic
transaction broadcasting in the wallet. This gives the user full control
of how the transaction is sent.

For example they can broadcast new transactions through some other
mechanism themselves, after getting the transaction hex through `gettransaction`.

This just adds the option `-walletbroadcast=<0,1>`. Right now these
transactions will get the status

    Status: conflicted, has not been successfully broadcast yet

They shouldn't be shown as conflicted at all (`walletconflicts` is empty). This status
will go away when the transaction is received through the network.
2015-04-01 13:03:39 +02:00
Gavin Andresen 0f5954c434
Regression test for ResendWalletTransactions
Adds a regression test for the wallet's ResendWalletTransactions function, which uses a new, hidden RPC command "resendwallettransactions."

I refactored main's Broadcast signal so it is passed the best-block time, which let me remove a global variable shared between main.cpp and the wallet (nTimeBestReceived).

I also manually tested the "rebroadcast unconfirmed every half hour or so" functionality by:

1. Running bitcoind -connect=0.0.0.0:8333
2. Creating a couple of send-to-self transactions
3. Connect to a peer using -addnode
4. Waited a while, monitoring debug.log, until I see:
```2015-03-23 18:48:10 ResendWalletTransactions: rebroadcast 2 unconfirmed transactions```

One last change: don't bother putting ResendWalletTransactions messages in debug.log unless unconfirmed transactions were actually rebroadcast.
2015-03-24 15:29:20 -04:00
Jorge Timón 8a893c949b Includes: Do not include main.h from any other header 2015-03-24 17:23:32 +01:00
Jorge Timón eca0b1ea62 Includes: MOVEONLY: move more method definitions out of wallet.h 2015-03-24 17:21:45 +01:00
Philip Kaufmann 341e2385d5 use constant references for strings in functions in wallet/*.* 2015-03-21 18:40:51 +01:00
dexX7 e9c3215b77
[Wallet] sort pending wallet transactions before reaccepting
During startup, when adding pending wallet transactions, which spend outputs of
other pending wallet transactions, back to the memory pool, and when they are
added out of order, it appears as if they are orphans with missing inputs.

Those transactions are then rejected and flagged as "conflicting" (= not in the
memory pool, not in the block chain).

To prevent this, transactions are explicitly sorted.
2015-03-21 13:03:23 +01:00
Jonas Schnelli 2bb1c87700 refactor: move bdb (bitdb) interaction from init.cpp to wallet.cpp
this will remove db.h from init.cpp
2015-03-20 16:23:39 +01:00
Wladimir J. van der Laan 05f17d4eaa
Merge pull request #5745
50c72f2 [Move Only] Move wallet related things to src/wallet/ (Jonas Schnelli)
2015-03-20 16:08:35 +01:00
Jonas Schnelli 50c72f23ad [Move Only] Move wallet related things to src/wallet/
could once be renamed from /src/wallet to /src/legacywallet.
2015-03-12 14:13:02 +01:00
Renamed from src/wallet.cpp (Browse further)