927 Commits

Author SHA1 Message Date
Warren Togami
bca95b3dd3 Merge remote-tracking branch 'bitcoin/0.10' into master-0.10 2015-04-29 18:35:22 -10:00
Suhas Daftuar
bac6fca3c9
Set nSequenceId when a block is fully linked
Also adds a test to CheckBlockIndex

Conflicts:
	src/main.cpp

Rebased-From: c1ecee8f723c2635fbd51100fa09acdb0cbec8a0
Github-Pull: #6010
2015-04-20 13:48:52 +02:00
Warren Togami
9780e91ac9 Merge remote-tracking branch 'bitcoin/0.10' into master-0.10 2015-04-16 20:10:00 -10:00
mrbandrews
57d1f46952
Fix CheckBlockIndex for reindex.
Some tests in CheckBlockIndex require chainActive.Tip(), but when reindexing, chainActive has not been set on the first call to CheckBlockIndex.

reindex.py starts a node, mines 3 blocks, stops, and reindexes with CheckBlockIndex enabled.

Rebased-From: 0421c18f3a261f04e83a03f59884e5798af74fd9
Github-Pull: #6012
2015-04-16 10:34:30 +02:00
Warren Togami
ca24fa8ad7 Litecoin: Default minRelayTxFee and CWallet::minTxFee set by DEFAULT_TX_FEE
Miners can adjust the minimum fee per 1000 bytes they are willing to accept
with the -minrelaytxfee parameter.
2015-04-12 12:28:01 -10:00
Warren Togami
1cfb09639d Merge remote-tracking branch 'bitcoin/0.10' into exp-0.10-mark17
Conflicts:
	configure.ac
	doc/release-process.md
	src/clientversion.h
	src/qt/bitcoingui.cpp
2015-04-11 20:51:04 -10:00
Pieter Wuille
a1f425b48b Add a consistency check for the block chain data structures
This adds a -checkblockindex (defaulting to true for regtest), which occasionally
does a full consistency check for mapBlockIndex, setBlockIndexCandidates, chainActive, and
mapBlocksUnlinked.
2015-03-27 17:24:07 -07:00
Alex Morcos
1d2cdd2ef9
Fix InvalidateBlock to add chainActive.Tip to setBlockIndexCandidates
Rebased-From: cd3d67cf3b0d573d2c387c2ec35e8b52129863d9
Github-Pull: #5890
2015-03-24 14:51:36 +01:00
Pieter Wuille
ca301bf98c
Reduce fingerprinting through timestamps in 'addr' messages.
Suggested by Jonas Nick.

Rebased-From: 9c2737901b5203f267d21d728019d64b46f1d9f3
Github-Pull: #5860
2015-03-17 16:39:10 +01:00
Alex Morcos
c91c660e49
fix InvalidateBlock to repopulate setBlockIndexCandidates
Rebased-From: a9af415887f03cb2565895bc55be72748549e527
Github-Pull: #5879
2015-03-12 17:51:00 +01:00
Cory Fields
002c8a2411
fix possible block db breakage during re-index
When re-indexing, there are a few cases where garbage data may be skipped in
the block files. In these cases, the indices are correctly written to the index
db, however the pointer to the next position for writing in the current block
file is calculated by adding the sizes of the valid blocks found.

As a result, when the re-index is finished, the index db is correct for all
existing blocks, but the next block will be written to an incorrect offset,
likely overwriting existing blocks.

Rather than using the sum of all valid blocks to determine the next write
position, use the end of the last block written to the file. Don't assume that
the current block is the last one in the file, since they may be read
out-of-order.

Rebased-From: bb6acff07982dda68b5c2ac81c99dbd7255bb9cc
Github-Pull: #5864
2015-03-11 08:34:43 +01:00
Ivan Pustogarov
200f29363b
Ignore getaddr messages on Outbound connections.
The only time when a client sends a "getaddr" message is when he
esatblishes an Outbound connection (see ProcessMessage() in
src/main.cpp).  Another bitcoin client is expected to receive a
"getaddr" message only on Inbound connection. Ignoring "gettaddr"
requests on Outbound connections can resolve potential privacy issues
(and as was said such request normally do not happen anyway).

Rebased-From: dca799e1db6e319fdd47e0bfdb038eab0efabb85
Github-Pull: #5442
2015-03-09 12:25:20 +01:00
Pieter Wuille
aeb9279228
Better fingerprinting protection for non-main-chain getdatas.
With headers-first we can compare against the best header timestamp, rather
than using checkpoints which require code updates to maintain.

Rebased-From: 85da07a5a001a563488382435202b74a3e3e964a
Github-Pull: #5820
2015-02-26 17:14:14 +01:00
Gregory Maxwell
23126a0a09 Sanitize command strings before logging them.
Normally bitcoin core does not display any network originated strings without
 sanitizing or hex encoding.  This wasn't done for strcommand in many places.

This could be used to play havoc with a terminal displaying the logs,
 especially with printtoconsole in use.

Thanks to Evil-Knievel for reporting this issue.

Conflicts:
	src/main.cpp
2015-02-24 08:40:07 +01:00
Warren Togami
72707115a7 Litecoin: Anti-spam mechanism adds 1000 bytes to the fee for each output smaller than DUST_THRESHOLD
Litecoin's current minimum relay tx fee is 0.001 LTC per 1000 bytes, which is also the DUST_THRESHOLD.
2015-02-06 11:48:49 -10:00
Warren Togami
480f0e7af2 Litecoin: Silence two non-errors during ProcessMessage disconnect
Otherwise it spams the log with "ProcessMessage(version, 106 bytes) FAILED" for no good reason.
2015-02-06 11:48:48 -10:00
Warren Togami
65507e099c Litecoin: Disconnect certain incompatible clients 2015-02-06 11:48:48 -10:00
Warren Togami
85245f1e63 Litecoin: Relay alerts prior to MIN_PEER_PROTO_VERSION disconnect
Otherwise the old client may fail to receive an alert saying they need to upgrade.
2015-02-06 11:48:48 -10:00
Warren Togami
1f2d64ffd4 Litecoin: Reduce high priority tx size limit to 5KB
This is the first step in making the high priority transaction area
available to more people.  Future versions of Litecoin will eventually
reduce this to 1KB per tx to match Bitcoin 0.8.6+.
2015-02-06 11:48:48 -10:00
Adrian Gallagher
ff0aed48ad Litecoin: Rename to Litecoin in non-Qt strings. 2015-02-05 15:01:34 -10:00
Warren Togami
c293a2efd2 Litecoin: Enforce v2 blocks, mainnet >= 710k, testnet >= 400k
regtest/unittest uses supermajority rule
2015-02-05 15:01:34 -10:00
Adrian Gallagher
9a98061200 Litecoin: Protocol. 2015-02-05 15:01:33 -10:00
Warren Togami
7a6894158b Litecoin: Scrypt n=1024 Pow hash based upon Colin Percival's Tarnsnap (2009)
Modified by Artforz, coblee, pooler, wtogami, Nikolay Belikov, Adrian Gallagher
2015-02-05 15:01:33 -10:00
Gregory Maxwell
1eb14af28f
Increase block download timeout base from 10 to 20 minutes.
This harmonizes the block fetch timeout with the existing ping timeout
 and eliminates a guaranteed eventual failure from congestion collapse
 for a network operating right at its limit.

It's unlikely that we wouldn't suffer other failures if we were really
 anywhere near the network's limit, and a complete avoidance of congestion
 collapse risk requires (I think) an exponential back-off. So this isn't
 a major concern, but I think it's also useful for reducing the complexity
 of understanding out timeouts.

Github-Pull: #5647
Rebased-From: 3ff735c99ae75c21397079f49859b81e89a2f5f8
2015-02-03 10:37:30 +01:00
Wladimir J. van der Laan
336f9fbd30
Merge pull request #5714
3916a81 Increase coverage of DERSIG edge cases (Pieter Wuille)
6da2028 Add RPC test for DERSIG BIP switchover logic (Pieter Wuille)
773c30d BIP66 changeover logic (Pieter Wuille)
18695f0 Example unit tests from BIP66 (Pieter Wuille)
abfbeaf Change IsDERSignature to BIP66 implementation (Pieter Wuille)
2015-02-03 10:33:58 +01:00
Pieter Wuille
2448d34298
Avoid storing a reference passed to SignatureChecker constructors
Rebased-From: 9fddceda44fb5592be179d783f0e5ac616c51c0d
Github-Pull: #5719
2015-02-03 08:52:13 +01:00
Pieter Wuille
1bbad80bf4
Use separate SignatureChecker for CMutableTransaction
Conflicts:
	src/main.cpp
	src/script/bitcoinconsensus.cpp

Rebased-From: 858809a33e4f690c4ad213f44a6c4465fc2ef025
Github-Pull: #5719
2015-02-03 08:48:04 +01:00
Pieter Wuille
773c30d756 BIP66 changeover logic 2015-02-01 17:57:38 -04:00
Pieter Wuille
a3a73170a9
Introduce 10 minute block download timeout
This will disconnect peers that do not transfer a block in 10 minutes, plus
5 minutes for every previously queued block with validated headers
(accomodating downstream bandwidth down to a few kilobytes per second - below
that the node would have trouble staying synchronized anyway).

Github-Pull: #5608
Rebased-From: 916130348ca803d762db912307b247f60f9aacd6
2015-01-12 11:28:23 +01:00
Pieter Wuille
867c600c29
Catch LevelDB errors during flush
Rebased-From: e41345790f1041f5c5e5605d73a0af174769aa55
Github-Pull: #5597
2015-01-07 13:11:58 +01:00
Pieter Wuille
3022e7df2a
Require sufficent priority for relay of free transactions
Rebased-From: 1c52aad540ec1370db60fd68fc3485413e3cb8e1
Github-Pull: #5535
2015-01-07 13:11:49 +01:00
Thomas Zander
94b362dbd6
On close of splashscreen interrupt verifyDB
With the splashscreen being able to be closed it is possible to
shutdown during the lengthy verifyDB method. (Takes about a minute
on my machine). This change allows us to shutdown much sooner.

Github-Pull: #5557
Rebased-From: 70477a0bdf6eb6d123ce256f064bbd3bc356c82a
2015-01-03 10:22:48 +01:00
Adam Weiss
d10a9015ad
DOS: Respect max per-peer blocks in flight limit
Don't allow immediate inv driven block downloads if
a peer already has MAX_BLOCKS_IN_TRANSIT_PER_PEER
active downloads.  Prevents bogus inv spam from
blowing up block transfer tracking data structures.

Rebased-From: c90770430d7c1eb7ece2d4ddb987b0f2210fd86f
Github-Pull: #5507
2014-12-23 12:36:26 +01:00
Pieter Wuille
8446262597
Reject headers that build on an invalid parent
Rebased-From: 34970223472c9e83689a1c710eebc7c16f152b02
Github-Pull: #5459
2014-12-23 12:01:09 +01:00
Peter Todd
0cb8763cbb
Check against MANDATORY flags prior to accepting to mempool
Previously transactions were only tested again the
STANDARD_SCRIPT_VERIFY_FLAGS prior to mempool acceptance, so any bugs in
those flags that allowed actually-invalid transactions to pass would
result in allowing invalid transactions into the mempool. Fortunately
there is a second check in CreateNewBlock() that would prevent those
transactions from being mined, resulting in an invalid block, however
this could still be exploited as a DoS attack.

Rebased-From: 7c041b3b91aa08a8f5863382b865a5174281ad03
2014-12-22 12:42:58 +01:00
Philip Kaufmann
b03632a671
add missing CAutoFile::IsNull() check in main
Rebased-From: 84857e87e42e412336ea60d0f8544c1679bab827
Github-Pull: #5437
2014-12-19 18:49:57 +01:00
Matt Corallo
723d12c098 Remove txn which are invalidated by coinbase maturity during reorg 2014-12-08 14:05:42 -08:00
Matt Corallo
868d041622 Remove coinbase-dependant transactions during reorg.
This still leaves transactions in mempool that are potentially
invalid if the maturity period has been reorged out of, but at
least they're not missing inputs entirely.
2014-12-08 14:05:42 -08:00
Wladimir J. van der Laan
b5fa132329
Merge pull request #5181
afd4b94 Move CMerkleBlock and CPartialMerkleTree to their own file (Matt Corallo)
2014-12-05 16:50:48 +01:00
Wladimir J. van der Laan
c78a18087f
Merge pull request #5308
60d1ecd change nSubsidy's type from int64_t to CAmount (HarryWu)
2014-12-05 11:11:24 +01:00
Matt Corallo
afd4b94b6d Move CMerkleBlock and CPartialMerkleTree to their own file 2014-12-05 01:57:40 -08:00
Wladimir J. van der Laan
9ddc8c63ab
Merge pull request #5394
307f7d4 Report script evaluation failures in log and reject messages (Pieter Wuille)
2014-12-04 16:43:35 +01:00
Pieter Wuille
307f7d48d4 Report script evaluation failures in log and reject messages 2014-12-02 22:05:03 +01:00
Michael Ford
c5b390b6b9 Make comments in main an init doxygen compatible
Fix typos where appropriate
Update license/copyright
2014-12-02 15:50:58 +08:00
Wladimir J. van der Laan
d7c8a830c4
Merge pull request #5316
f86a24b Move `setmocktime` to hidden category (Wladimir J. van der Laan)
bd9aebf Introduce a hidden category (Pieter Wuille)
0dd06b2 Delay writing block indexes in invalidate/reconsider (Pieter Wuille)
9b0a8d3 Add 'invalidateblock' and 'reconsiderblock' RPC commands. (Pieter Wuille)
2014-11-28 11:19:15 +01:00
Pieter Wuille
57be955ba0 Remove -printblock, -printblocktree, and -printblockindex 2014-11-27 09:50:20 +01:00
Pieter Wuille
0dd06b2515 Delay writing block indexes in invalidate/reconsider 2014-11-26 16:36:26 +01:00
Pieter Wuille
9b0a8d3152 Add 'invalidateblock' and 'reconsiderblock' RPC commands.
These can be used for testing reorganizations or for manual intervention in case of
chain forks.
2014-11-26 16:36:25 +01:00
Wladimir J. van der Laan
9ff0bc9beb
Merge pull request #5158
9ec75c5 Add a locking mechanism to IsInitialBlockDownload to ensure it never goes from false to true. (Ruben Dario Ponticelli)
a2d0fc6 Fix IsInitialBlockDownload which was broken by headers first. (Ruben Dario Ponticelli)
2014-11-26 15:09:03 +01:00
Wladimir J. van der Laan
53a87c0355
Merge pull request #5321
34559c7 Make PruneBlockIndexCandidates safer (Pieter Wuille)
cca48f6 Reset setBlockIndexCandidates once block index db loaded (21E14)
2014-11-26 13:31:03 +01:00