Commit Graph

501 Commits

Author SHA1 Message Date
Matt Corallo f89faa2584 Call the -alertnotify script when we see a long or invalid fork. 2013-07-22 12:11:46 +02:00
Matt Corallo b8585384da Detect any sufficiently long fork and add a warning.
Such a fork is defined as being at least 7 blocks long and
having a tip which is within 72 blocks of our best block.
2013-07-22 12:10:57 +02:00
Jeff Garzik d598872726 Merge pull request #2743 from jgarzik/reject-reason
Log reason for non-standard transaction rejection
2013-07-10 08:50:49 -07:00
Pieter Wuille 4ad73c6b08 Merge pull request #2209 from CodeShark/WalletRegistrationLocks
Wallet registration locks in main.cpp + UnregisterAllWallet() function
2013-06-25 16:33:16 -07:00
Jeff Garzik 481d899794 Merge pull request #2792 from sipa/coreimpl
Move core implementations to core.cpp
2013-06-25 11:52:18 -07:00
Peter Todd c40a5aaaf4 Truncate oversize 'tx' messages before relaying/storing.
Fixes a memory exhaustion attack on low-memory peers.
2013-06-25 10:37:50 -04:00
Pieter Wuille f121db58e4 Move core implementations to core.cpp 2013-06-25 10:33:29 +02:00
Eric Lombrozo e5cefb9be1 Added locks on the setpwalletRegistered functions in main.cpp and added an UnregisterAllWallets function. 2013-06-24 09:25:23 -07:00
Eric Lombrozo 2a4d3464fd Pulled AcceptBlock out of CBlock. 2013-06-23 19:59:35 -07:00
Eric Lombrozo 38991ffa8a Pulled CheckBlock out of CBlock. 2013-06-23 19:59:35 -07:00
Eric Lombrozo 1959997afb Pulled AddToBlockIndex out of CBlock. 2013-06-23 19:59:35 -07:00
Eric Lombrozo f3ae51dcce Pulled ConnectBlock out of CBlock. 2013-06-23 19:59:35 -07:00
Eric Lombrozo 5c363ed622 Pulled DisconnectBlock out of CBlock. 2013-06-23 19:59:34 -07:00
Eric Lombrozo 8031399494 Moved ReadBlockFromDisk implementation to main.cpp 2013-06-23 19:59:34 -07:00
Eric Lombrozo 7db120d531 Moved CBlock::ReadFromDisk out of CBlock to functions ReadBlockFromDisk in main.h 2013-06-23 19:59:34 -07:00
Eric Lombrozo 226f821942 Moved WriteBlockToDisk implementation from main.h to main.cpp 2013-06-23 19:59:32 -07:00
Eric Lombrozo a6dba0fdb2 Moved CBlock::WriteToDisk out of CBlock to inline function WriteBlockToDisk in main.h 2013-06-23 19:58:23 -07:00
Jeff Garzik 4be2aba302 Merge pull request #2778 from jgarzik/rpc-verifydb
RPC: add 'verifychain' to verify chain database at runtime
2013-06-22 23:08:13 -07:00
Jeff Garzik 980bfe6ef8 Log reason for non-standard transaction rejection 2013-06-23 02:05:25 -04:00
Pieter Wuille b4a8a326c0 Merge pull request #2660 from TheBlueMatt/gmfrefactor
Refactor fee rules to make them actually readable.
2013-06-22 10:08:57 -07:00
Jeff Garzik f590653377 RPC: add 'verifychain', to verify chain database at runtime 2013-06-19 11:53:02 -04:00
Jeff Garzik 168ba99392 Pass check level, check depth to VerifyDB() 2013-06-19 11:32:49 -04:00
Mike Hearn 0e4b317555 Introduce a CChainParameters singleton class and regtest mode.
The new class is accessed via the Params() method and holds
most things that vary between main, test and regtest networks.
The regtest mode has two purposes, one is to run the
bitcoind/bitcoinj comparison tool which compares two separate
implementations of the Bitcoin protocol looking for divergence.

The other is that when run, you get a local node which can mine
a single block instantly, which is highly convenient for testing
apps during development as there's no need to wait 10 minutes for
a block on the testnet.
2013-06-19 16:28:52 +02:00
Mike Hearn 70e7fba06d Move implementation of some CBlockLocator methods
Move out of main.h to improve compile times and add documentation
for what the methods do.
2013-06-19 15:39:45 +02:00
Matt Corallo 87cce04c17 Refactor fee rules to make them actually readable.
This (nearly) doesn't change fee rules at all:
 * To make it into the fee transaction area, the dPriority comparison
   changed from < to <=
 * We now just ignore transactions > MAX_BLOCK_SIZE/4 instead of
   doing some calculations to require increasingly large fees as
   size increases.
2013-06-14 13:37:43 +02:00
Matt Corallo b1f15b218b Remove broken option to skip input checking for wallet txn. 2013-06-13 22:28:03 +02:00
Eric Lombrozo 501da2503a Using boost::signals2 to message main from net.cpp. 2013-06-05 23:15:20 -07:00
Eric Lombrozo aabdf9e899 Moved UpdateTime out of CBlockHeader and moved CBlockHeader into core. 2013-06-05 23:15:20 -07:00
Eric Lombrozo 05df3fc68d Removed AcceptToMemoryPool method from CTransaction. This method belongs to the mempool instance.
Removed AreInputsStandard from CTransaction, made it a regular function in main.
Moved CTransaction::GetOutputFor to CCoinsViewCache.

Moved GetLegacySigOpCount and GetP2SHSigOpCount out of CTransaction into regular functions in main.

Moved GetValueIn and HaveInputs from CTransaction into CCoinsViewCache.

Moved AllowFree, ClientCheckInputs, CheckInputs, UpdateCoins, and CheckTransaction out of CTransaction and into main.

Moved IsStandard and IsFinal out of CTransaction and put them in main as IsStandardTx and IsFinalTx. Moved GetValueOut out of CTransaction into main. Moved CTxIn, CTxOut, and CTransaction into core.

Added minimum fee parameter to CTxOut::IsDust() temporarily until CTransaction is moved to core.h so that CTxOut needn't know about CTransaction.
2013-06-05 23:15:20 -07:00
Eric Lombrozo 788536f175 Moved CInPoint to core. Removed GetMinFee from CTransaction and made it a regular function in main. 2013-06-05 23:15:19 -07:00
Eric Lombrozo 8926263dde Moved PushGetBlocks to main.cpp to eliminate dependence of net.cpp on CBlockLocator. 2013-06-05 20:36:10 -07:00
Cory Fields 13c84b3bd5 build: add global var for whether or not the gui is enabled 2013-06-04 03:54:14 -04:00
Philip Kaufmann 3260b4c090 remove GetBoolArg() fDefault parameter defaulting to false
- explicitly set the default of all GetBoolArg() calls
- rework getarg_test.cpp and util_tests.cpp to cover this change
- some indentation fixes
- move macdockiconhandler.h include in bitcoin.cpp to the "our headers"
  section
2013-06-01 12:53:57 +02:00
Jeff Garzik d397715661 Merge pull request #2644 from sipa/constfindblock
Make FindBlockByHeight constant-time
2013-05-30 08:06:44 -07:00
Jeff Garzik af93273799 Merge pull request #2657 from gmaxwell/its_after_may15_forever
It's after 2013-05-15 forever now, so remove the code for the May 15 fork
2013-05-30 07:35:44 -07:00
Pieter Wuille 95c7db3dbf More bestblock records in wallets
Write bestblock records in wallets:
* Every 20160 blocks synced, no matter what (before: none during IBD)
* Every 144 blocks after IBD (before: for every block, slow)
* When creating a new wallet
* At shutdown

This should result in far fewer spurious rescans.
2013-05-22 20:59:36 +02:00
Pieter Wuille 2ec349bc42 CreateNewBlock performance improvements 2013-05-21 03:53:32 +02:00
Gregory Maxwell a824121eb8 It's after 2013-05-15 forever now, so remove the code for the May 15 fork. 2013-05-16 13:34:01 -07:00
Pieter Wuille 0fe8010a10 Make FindBlockByHeight constant-time.
Remove the pnext pointer in CBlockIndex, and replace it with a
vBlockIndexByHeight vector (no effect on memory usage). pnext can
now be replaced by vBlockIndexByHeight[nHeight+1], but
FindBlockByHeight becomes constant-time.

This also means the entire mapBlockIndex structure and the block
index entries in it become purely blocktree-related data, and
independent from the currently active chain, potentially allowing
them to be protected by separate mutexes in the future.
2013-05-12 19:52:16 +02:00
Gavin Andresen 33edd0a477 Merge pull request #2577 from gavinandresen/fee_bandaid
Treat dust outputs as non-standard, un-hardcode TX_FEE constants
2013-05-04 10:15:39 -07:00
Gavin Andresen 000dc55181 Un-hardcode TX_FEE constants
Allow setting of MIN_TX_FEE / MIN_RELAY_TX_FEE with
-mintxfee / -mintxrelayfee

Default values are the same (0.0001 BTC).
2013-05-03 10:54:31 -04:00
Gavin Andresen 8de9bb53af Define dust transaction outputs, and make them non-standard 2013-05-03 10:52:09 -04:00
Pieter Wuille 360cfe142c Allow the default key to be unavailable
This solves the issue where no default key can be added after -salvagewallet.
2013-04-25 19:36:10 +02:00
Pieter Wuille 97e7901a3a Do not invoke DoS for non-canonical sigs 2013-04-18 22:49:23 +02:00
Pieter Wuille 20d0810f30 Require strictly-standard encodings in mempool 2013-04-14 00:17:49 +02:00
Pieter Wuille 1657c4bc49 Use a uint256 for bnChainWork
Every block index entry currently requires a separately-allocated
CBigNum. By replacing them with uint256, it's just 32 bytes extra
in CBlockIndex itself.

This should save us a few megabytes in RAM, and less allocation
overhead.
2013-04-12 12:17:28 +02:00
Gavin Andresen f158e363a4 Merge pull request #2478 from sipa/fullhash
Always print full hashes (tx, block, inv)
2013-04-09 10:57:16 -07:00
Pieter Wuille 6ed71b5e4f Make sure we always have a node to do IBD from
This introduces the concept of the 'sync node', which is the one we
asked for missing blocks. In case the sync node goes away, a new one
will be selected.

For now, the heuristic is very simple, but it can easily be extended
later to add better policies.
2013-04-07 19:19:13 +02:00
Pieter Wuille 1c06aa98c6 Always print full hashes (tx, block, inv) 2013-04-07 03:43:55 +02:00
Philip Kaufmann b001c87126 small indentation, space, formatting fixes (no code changes) 2013-04-06 02:29:33 +02:00