aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
AgeCommit message (Collapse)Author
2016-11-03Fix compact block handling to not ban if block is invalidSuhas Daftuar
2016-11-03Merge #8969: Decouple peer-processing-logic from block-connection-logic (#2)Wladimir J. van der Laan
f5b960b Move nTimeBestReceived updating into net processing code (Matt Corallo) d8670fb Move all calls to CheckBlockIndex out of net-processing logic (Matt Corallo) d6ea737 Remove network state wipe from UnloadBlockIndex. (Matt Corallo) fc0c24f Move MarkBlockAsReceived out of ProcessNewMessage (Matt Corallo) 65f35eb Move FlushStateToDisk call out of ProcessMessages::TX into ATMP (Matt Corallo)
2016-11-03Merge #9053: IBD using chainwork instead of height and not using header ↵Pieter Wuille
timestamps e141beb IsInitialBlockDownload no longer uses header-only timestamps. (Gregory Maxwell) 2082b55 Remove GetTotalBlocksEstimate and checkpoint tests that test nothing. (Gregory Maxwell) fd46136 IBD check uses minimumchain work instead of checkpoints. (Gregory Maxwell)
2016-11-02Merge #9013: Trivial: Explicitly pass const CChainParams& to LoadBlockIndexDB()Wladimir J. van der Laan
d0b01f3 Explicitly pass const CChainParams& to LoadBlockIndexDB() (Geoffrey Tsui)
2016-11-02IsInitialBlockDownload no longer uses header-only timestamps.Gregory Maxwell
This avoids a corner case (mostly visible on testnet) where bogus headers can keep nodes in IsInitialBlockDownload.
2016-11-02IBD check uses minimumchain work instead of checkpoints.Gregory Maxwell
This introduces a 'minimum chain work' chainparam which is intended to be the known amount of work in the chain for the network at the time of software release. If you don't have this much work, you're not yet caught up. This is used instead of the count of blocks test from checkpoints. This criteria is trivial to keep updated as there is no element of subjectivity, trust, or position dependence to it. It is also a more reliable metric of sync status than a block count.
2016-10-31Move nTimeBestReceived updating into net processing codeMatt Corallo
2016-10-31Move all calls to CheckBlockIndex out of net-processing logicMatt Corallo
This will result in many more calls to CheckBlockIndex when connecting a list of headers (eg in ::HEADERS messages processing) but its only enabled in debug mode, and that should mostly just be during IBD, so it should be OK.
2016-10-31Remove network state wipe from UnloadBlockIndex.Matt Corallo
UnloadBlockIndex is only used during init if we end up reindexing to clear our block state so that we can start over. However, at that time no connections have been brought up as CConnman hasn't been started yet, so all of the network processing state logic is empty when its called. Additionally, the initialization of the recentRejects set is moved to InitPeerLogic.
2016-10-31Move MarkBlockAsReceived out of ProcessNewMessageMatt Corallo
2016-10-31Move FlushStateToDisk call out of ProcessMessages::TX into ATMPMatt Corallo
2016-10-31Add DumpMempool and LoadMempoolPieter Wuille
2016-10-30Add AcceptToMemoryPoolWithTime functionPieter Wuille
2016-10-25Explicitly pass const CChainParams& to LoadBlockIndexDB()Geoffrey Tsui
2016-10-25Merge #8515: A few mempool removal optimizationsWladimir J. van der Laan
0334430 Add some missing includes (Pieter Wuille) 4100499 Return shared_ptr<CTransaction> from mempool removes (Pieter Wuille) 51f2783 Make removed and conflicted arguments optional to remove (Pieter Wuille) f48211b Bypass removeRecursive in removeForReorg (Pieter Wuille)
2016-10-24Merge #8995: Add missing cs_main lock to ::GETBLOCKTXN processingWladimir J. van der Laan
dfe7906 Add missing cs_main lock to ::GETBLOCKTXN processing (Matt Corallo)
2016-10-21Return shared_ptr<CTransaction> from mempool removesPieter Wuille
2016-10-21Make removed and conflicted arguments optional to removePieter Wuille
2016-10-21Fix doxygen comment: the transaction is returned in txOutPavel Janík
2016-10-21Add missing cs_main lock to ::GETBLOCKTXN processingMatt Corallo
Note that this is not a major issue as, in order for the missing lock to cause issues, you have to receive a GETBLOCKTXN message while reindexing, adding a block header via RPC, etc, which results in either a table rehash or an insert into the bucket which you are currently looking at.
2016-10-21Merge #8968: Don't hold cs_main when calling ProcessNewBlock from a cmpctblockWladimir J. van der Laan
72ca7d9 Don't hold cs_main when calling ProcessNewBlock from a cmpctblock (Matt Corallo)
2016-10-20Use pindexBestHeader instead of setBlockIndexCandidates for NotifyHeaderTip()Jonas Schnelli
2016-10-19RPC: augment getblockchaininfo bip9_softforks datamruddy
2016-10-19Merge #8936: Report NodeId in misbehaving debugWladimir J. van der Laan
a1919ad Report NodeId in misbehaving debug (R E Broadley)
2016-10-18Merge #8865: Decouple peer-processing-logic from block-connection-logicWladimir J. van der Laan
a9aec5c Use BlockChecked signal to send reject messages from mapBlockSource (Matt Corallo) 7565e03 Remove SyncWithWallets wrapper function (Matt Corallo) 12ee1fe Always call UpdatedBlockTip, even if blocks were only disconnected (Matt Corallo) f5efa28 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain (Matt Corallo) fef1010 Use CValidationInterface from chain logic to notify peer logic (Matt Corallo) aefcb7b Move net-processing logic definitions together in main.h (Matt Corallo) 0278fb5 Remove duplicate nBlocksEstimate cmp (we already checked IsIBD()) (Matt Corallo) 87e7d72 Make validationinterface.UpdatedBlockTip more verbose (Matt Corallo)
2016-10-18Merge #6996: Add preciousblock RPCWladimir J. van der Laan
5805ac8 Add preciousblock tests (Pieter Wuille) 5127c4f Add preciousblock RPC (Pieter Wuille)
2016-10-18Don't hold cs_main when calling ProcessNewBlock from a cmpctblockMatt Corallo
2016-10-18Merge #8637: Compact Block Tweaks (rebase of #8235)Wladimir J. van der Laan
3ac6de0 Align constant names for maximum compact block / blocktxn depth (Pieter Wuille) b2e93a3 Add cmpctblock to debug help list (instagibbs) fe998e9 More agressively filter compact block requests (Matt Corallo) 02a337d Dont remove a "preferred" cmpctblock peer if they provide a block (Matt Corallo)
2016-10-18Merge #8914: Kill insecure_random and associated global stateWladimir J. van der Laan
5eaaa83 Kill insecure_random and associated global state (Wladimir J. van der Laan)
2016-10-18Report NodeId in misbehaving debugR E Broadley
2016-10-17Align constant names for maximum compact block / blocktxn depthPieter Wuille
2016-10-17More agressively filter compact block requestsMatt Corallo
Unit test adaptations by Pieter Wuille.
2016-10-17Dont remove a "preferred" cmpctblock peer if they provide a blockMatt Corallo
2016-10-17Merge #8499: Add several policy limits and disable uncompressed keys for ↵Wladimir J. van der Laan
segwit scripts 67d6ee1 remove redundant tests in p2p-segwit.py (Johnson Lau) 9260085 test segwit uncompressed key fixes (Johnson Lau) 248f3a7 Fix ismine and addwitnessaddress: no uncompressed keys in segwit (Pieter Wuille) b811124 [qa] Add tests for uncompressed pubkeys in segwit (Suhas Daftuar) 9f0397a Make test framework produce lowS signatures (Johnson Lau) 4c0c25a Require compressed keys in segwit as policy and disable signing with uncompressed keys for segwit scripts (Johnson Lau) 3ade2f6 Add standard limits for P2WSH with tests (Johnson Lau)
2016-10-17Kill insecure_random and associated global stateWladimir J. van der Laan
There are only a few uses of `insecure_random` outside the tests. This PR replaces uses of insecure_random (and its accompanying global state) in the core code with an FastRandomContext that is automatically seeded on creation. This is meant to be used for inner loops. The FastRandomContext can be in the outer scope, or the class itself, then rand32() is used inside the loop. Useful e.g. for pushing addresses in CNode or the fee rounding, or randomization for coin selection. As a context is created per purpose, thus it gets rid of cross-thread unprotected shared usage of a single set of globals, this should also get rid of the potential race conditions. - I'd say TxMempool::check is not called enough to warrant using a special fast random context, this is switched to GetRand() (open for discussion...) - The use of `insecure_rand` in ConnectThroughProxy has been replaced by an atomic integer counter. The only goal here is to have a different credentials pair for each connection to go on a different Tor circuit, it does not need to be random nor unpredictable. - To avoid having a FastRandomContext on every CNode, the context is passed into PushAddress as appropriate. There remains an insecure_random for test usage in `test_random.h`.
2016-10-16Add standard limits for P2WSH with testsJohnson Lau
2016-10-15Merge #8880: protocol.h: Move MESSAGE_START_SIZE into CMessageHeaderWladimir J. van der Laan
1df3111 protocol.h: Make enums in GetDataMsg concrete values (Wladimir J. van der Laan) 2c09a52 protocol.h: Move MESSAGE_START_SIZE into CMessageHeader (Wladimir J. van der Laan) f9bd92d version.h: s/shord/short/ in comment (Wladimir J. van der Laan)
2016-10-04Use BlockChecked signal to send reject messages from mapBlockSourceMatt Corallo
2016-10-04Remove SyncWithWallets wrapper functionMatt Corallo
2016-10-04Always call UpdatedBlockTip, even if blocks were only disconnectedMatt Corallo
2016-10-04Remove CConnman parameter from ProcessNewBlock/ActivateBestChainMatt Corallo
2016-10-04Use CValidationInterface from chain logic to notify peer logicMatt Corallo
This adds a new CValidationInterface subclass, defined in main.h, to receive notifications of UpdatedBlockTip and use that to push blocks to peers, instead of doing it directly from ActivateBestChain.
2016-10-04Use cmpctblock type 2 for segwit-enabled transferPieter Wuille
Contains version negotiation logic by Matt Corallo and bugfixes by Suhas Daftuar.
2016-10-04Remove duplicate nBlocksEstimate cmp (we already checked IsIBD())Matt Corallo
2016-10-04Make validationinterface.UpdatedBlockTip more verboseMatt Corallo
In anticipation of making all the callbacks out of block processing flow through it. Note that vHashes will always have something in it since pindexFork != pindexNewTip.
2016-10-04Make GetFetchFlags always request witness objects from witness peersMatt Corallo
This fixes a bug where we might (in exceedingly rare circumstances) accidentally ban a node for sending us the first (potentially few) segwit blocks in non-segwit mode.
2016-10-04protocol.h: Move MESSAGE_START_SIZE into CMessageHeaderWladimir J. van der Laan
Also move the enum to the top, and remove a deceptive TODO comment.
2016-10-01net: fix a few cases where messages were sent rather than dropped upon ↵Cory Fields
disconnection 75ead758 turned these into crashes in the event of a handshake failure, most notably when a peer does not offer the expected services. There are likely other cases that these assertions will find as well.
2016-09-28net: Consistent checksum handlingWladimir J. van der Laan
In principle, the checksums of P2P packets are simply 4-byte blobs which are the first four bytes of SHA256(SHA256(payload)). Currently they are handled as little-endian 32-bit integers half of the time, as blobs the other half, sometimes copying the one to the other, resulting in somewhat confused code. This PR changes the handling to be consistent both at packet creation and receiving, making it (I think) easier to understand.
2016-09-27Do not shadow variablesPavel Janík