Commit graph

330 commits

Author SHA1 Message Date
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)