Commit Graph

431 Commits

Author SHA1 Message Date
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
mrbandrews f9ec3f0fad Add block pruning functionality
This adds a -prune=N option to bitcoind, which if set to N>0 will enable block
file pruning. When pruning is enabled, block and undo files will be deleted to
try to keep total space used by those files to below the prune target (N, in
MB) specified by the user, subject to some constraints:

- The last 288 blocks on the main chain are always kept (MIN_BLOCKS_TO_KEEP),
- N must be at least 550MB (chosen as a value for the target that could
  reasonably be met, with some assumptions about block sizes, orphan rates,
  etc; see comment in main.h),
- No blocks are pruned until chainActive is at least 100,000 blocks long (on
  mainnet; defined separately for mainnet, testnet, and regtest in chainparams
  as nPruneAfterHeight).

This unsets NODE_NETWORK if pruning is enabled.

Also included is an RPC test for pruning (pruning.py).

Thanks to @rdponticelli for earlier work on this feature; this is based in
part off that work.
2015-04-22 15:53:48 -04:00
jtimon 691161d419 Consensus: Create consensus/consensus.h with some constants 2015-04-20 21:27:51 +02:00
Wladimir J. van der Laan 3e8a1f2725
Merge pull request #5900
3fcfbc8 Add a consistency check for the block chain data structures (Pieter Wuille)
2015-04-01 17:20:38 +02:00
Wladimir J. van der Laan 446bb70fcd
Merge pull request #5940
0f5954c Regression test for ResendWalletTransactions (Gavin Andresen)
2015-03-30 14:28:09 +02:00
Pieter Wuille 3fcfbc8ac5 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 13:38:48 -07:00
Wladimir J. van der Laan 6a1fbc4921
Merge pull request #5942
fc72020 don't trickle for whitelisted nodes (Ruben de Vries)
2015-03-26 08:33:00 +01:00
Jorge Timón d698ef690f Consensus: Refactor: Decouple pow.o from chainparams.o 2015-03-26 00:47:51 +01: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 26c16d9de9 Includes: Refactor: Move CValidationInterface and CMainSignals out of main 2015-03-24 17:21:41 +01:00
Ruben de Vries fc720207e0 don't trickle for whitelisted nodes 2015-03-24 14:53:16 +01:00
Daira Hopwood 1371e6f5db Change "insane" to "absurd" (referring to high fees) in text strings and identifiers.
Note that this will also require translation changes in Transifex for the key
"A fee higher than %1 is considered an insanely high fee." which is now
"A fee higher than %1 is considered an absurdly high fee."

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-01-31 23:23:20 +00:00
Wladimir J. van der Laan 7810a0a1e6
Merge pull request #5648
2ce63d3 MOVEONLY: Move struct CBlockTemplate to miner.h (from main.h) (Luke Dashjr)
2015-01-20 17:34:43 +01:00
Luke Dashjr 2ce63d395f MOVEONLY: Move struct CBlockTemplate to miner.h (from main.h) 2015-01-12 20:47:44 +01:00
Wladimir J. van der Laan c8183bf8ea
Merge pull request #5589
23f3435 Rename MAX_TX_SIGOPS to MAX_STANDARD_TX_SIGOPS to match similar policy constant MAX_STANDARD_TX_SIZE (Luke Dashjr)
2015-01-08 12:38:10 +01:00
Wladimir J. van der Laan 807658549c Replace GetLow64 with GetCheapHash 2015-01-05 15:45:34 +01:00
Luke Dashjr 23f3435962 Rename MAX_TX_SIGOPS to MAX_STANDARD_TX_SIGOPS to match similar policy constant MAX_STANDARD_TX_SIZE 2015-01-01 11:35:51 +00:00
jtimon 937ba572d0 MOVEONLY: CBlockUndo from main.h to undo.h 2014-12-27 16:01:31 +01:00
jtimon e035c6a737 Decouple CBlockUndo from CDiskBlockPos 2014-12-27 16:01:31 +01:00
jtimon d7621ccf9d Decouple miner.o and txmempool.o from CTxUndo 2014-12-27 16:01:12 +01:00
Jameson Lopp 4bc95c4387 remove max orphan blocks config parameter since it is no longer functional 2014-12-21 09:10:43 -05:00
sandakersmann f914f1a746
Added "Core" to copyright headers
Github-Pull: #5494
Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-19 19:55:32 +01: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
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
Wladimir J. van der Laan a0417b8cc8 Merge pull request #5306
d227011 MOVEONLY: core/ -> primitives/ (Luke Dashjr)
2014-12-03 12:05:43 +01:00
Luke Dashjr d227011184 MOVEONLY: core/ -> primitives/ 2014-12-03 10:52:58 +00: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 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
Pieter Wuille 51ce901aa3 Improve chainstate/blockindex disk writing policy
There are 3 pieces of data that are maintained on disk. The actual block
and undo data, the block index (which can refer to positions on disk),
and the chainstate (which refers to the best block hash).

Earlier, there was no guarantee that blocks were written to disk before
block index entries referring to them were written. This commit introduces
dirty flags for block index data, and delays writing entries until the actual
block data is flushed.

With this stricter ordering in writes, it is now safe to not always flush
after every block, so there is no need for the IsInitialBlockDownload()
check there - instead we just write whenever enough time has passed or
the cache size grows too large. Also updating the wallet's best known block
is delayed until this is done, otherwise the wallet may end up referring to an
unknown block.

In addition, only do a write inside the block processing loop if necessary
(because of cache size exceeded). Otherwise, move the writing to a point
after processing is done, after relaying.
2014-11-24 15:15:40 +01:00
Luke Dashjr df08a626e0 TestBlockValidity function for CBlock proposals (used by CreateNewBlock) 2014-11-18 19:20:10 +00:00
Luke Dashjr a48f2d6ddd Abstract context-dependent block checking from acceptance 2014-11-18 19:20:10 +00:00
Wladimir J. van der Laan 4e852e57b1
Merge pull request #5186
771d500 minor cleanup: include orders, end comments etc. (Philip Kaufmann)
2014-11-03 15:03:28 +01:00
Wladimir J. van der Laan 84d26d3a36
Merge pull request #5106
1bea2bb Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and document it (Luke Dashjr)
d29a291 Rename RPC_TRANSACTION_* errors to RPC_VERIFY_* and use RPC_VERIFY_ERROR for submitblock (Luke Dashjr)
f877aaa Bugfix: submitblock: Use a temporary CValidationState to determine accurately the outcome of ProcessBlock, now that it no longer does the full block validity check (Luke Dashjr)
24e8896 Add CValidationInterface::BlockChecked notification (Luke Dashjr)
2014-11-03 12:22:45 +01:00
Philip Kaufmann 771d500283 minor cleanup: include orders, end comments etc.
- no code changes
2014-10-31 09:41:15 +01:00
Luke Dashjr 1bea2bbddc Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and document it 2014-10-28 08:15:14 +00:00
jtimon 99f41b9cf7 MOVEONLY: core.o -> core/block.o 2014-10-27 13:54:37 +01:00
jtimon 999a2ab41e MOVEONLY: separate CTxUndo out of core 2014-10-27 13:54:37 +01:00
jtimon 4a3587d8db MOVEONLY: Separate CTransaction and dependencies from core 2014-10-27 13:54:37 +01:00
jtimon eda3733091 MOVEONLY: Move CFeeRate and Amount constants to amount.o 2014-10-27 13:54:37 +01:00
Wladimir J. van der Laan 25cc1cf8dc
Merge pull request #4981
85c579e script: add a slew of includes all around and drop includes from script.h (Cory Fields)
db8eb54 script: move ToString and ValueString out of the header (Cory Fields)
e9ca428 script: add ToByteVector() for converting anything with begin/end (Cory Fields)
066e2a1 script: move CScriptID to standard.h and add a ctor for creating them from CScripts (Cory Fields)
2014-10-22 12:16:50 +02:00
Luke Dashjr 24e8896430 Add CValidationInterface::BlockChecked notification 2014-10-21 04:41:46 +00:00
Pieter Wuille a96d113962 Rename CWalletInterface to CValidationInterface
It's useful for much more than wallets.
2014-10-20 10:59:12 -07:00
Cory Fields 85c579e3a6 script: add a slew of includes all around and drop includes from script.h
Lots of files ended up with indirect includes from script.h.
2014-10-17 13:44:57 -04:00
Pieter Wuille ad6e601712 RPC additions after headers-first 2014-10-14 15:42:01 -07:00
Pieter Wuille 341735eb8f Headers-first synchronization
Many changes:
* Do not use 'getblocks', but 'getheaders', and use it to build a headers tree.
* Blocks are fetched in parallel from all available outbound peers, using a
  limited moving window. When one peer stalls the movement of the window, it is
  disconnected.
* No more orphan blocks. At all. We only ever request a block for which we have
  verified the headers, and store it to disk immediately. This means that a
  disk-fill attack would require PoW.
* Require protocol version 31800 for every peer (released in december 2010).
* No more syncnode (we sync from everyone we can, though limited to 1 during
  initial *headers* sync).
* Introduce some extra named constants, comments and asserts.
2014-10-14 15:42:01 -07:00
Wladimir J. van der Laan 5505a1b13f
Merge pull request #5036
eb6b3b2 Update English translation (Wladimir J. van der Laan)
b9b2e3f Don't translate state.Abort() messages (Wladimir J. van der Laan)
2014-10-06 04:42:09 +02:00