aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
AgeCommit message (Collapse)Author
2016-12-02Rename the remaining main.{h,cpp} to validation.{h,cpp}Matt Corallo
2016-12-02Move network-msg-processing code out of main to its own fileMatt Corallo
2016-12-01Remove orphan state wipe from UnloadBlockIndex.Matt Corallo
As orphan state is now "network state", like in d6ea737be19a0001e69e4e854eb1cef21523ea7a, 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.
2016-12-01Merge #9183: Final Preparation for main.cpp SplitPieter Wuille
2c8c57e Document cs_main status when calling into PNB or PNBH (Matt Corallo) 58a215c Use ProcessNewBlockHeaders in CMPCTBLOCK processing (Matt Corallo) a8b936d Use exposed ProcessNewBlockHeaders from ProcessMessages (Matt Corallo) 63fd101 Split ::HEADERS processing into two separate cs_main locks (Matt Corallo) 4a6b1f3 Expose AcceptBlockHeader through main.h (Matt Corallo)
2016-12-01Merge #9188: Make orphan parent fetching ask for witnesses.Pieter Wuille
5b0150a Make orphan parent fetching ask for witnesses. (Gregory Maxwell)
2016-12-01Use ProcessNewBlockHeaders in CMPCTBLOCK processingMatt Corallo
2016-12-01Use exposed ProcessNewBlockHeaders from ProcessMessagesMatt Corallo
2016-11-30Merge #9226: Remove fNetworkNode and pnodeLocalHost.Pieter Wuille
bdb922b Remove pnodeLocalHost. (Gregory Maxwell) 083f203 Remove fNetworkNode. (Gregory Maxwell)
2016-11-29Merge #9225: Fix some benign racesWladimir J. van der Laan
dfed983 Fix unlocked access to vNodes.size() (Matt Corallo) 3033522 Remove double brackets in addrman (Matt Corallo) dbfaade Fix AddrMan locking (Matt Corallo) 047ea10 Make fImporting an std::atomic (Matt Corallo) 42071ca Make fDisconnect an std::atomic (Matt Corallo)
2016-11-28Fix some typosfsb4000
2016-11-27Remove fNetworkNode.Gregory Maxwell
Matt pointed out to me that this appeared to be doing nothing (except involving itself in data races).
2016-11-26Make fImporting an std::atomicMatt Corallo
2016-11-25Merge #9128: net: Decouple CConnman and message serializationPieter Wuille
c7be56d net: push only raw data into CConnman (Cory Fields) 2ec935d net: add CVectorWriter and CNetMsgMaker (Cory Fields) b7695c2 net: No need to check individually for disconnection anymore (Cory Fields) fedea8a net: don't send any messages before handshake or after requested disconnect (Cory Fields) d74e352 net: Set feelers to disconnect at the end of the version message (Cory Fields)
2016-11-25net: push only raw data into CConnmanCory Fields
This fixes one of the last major layer violations in the networking stack. The network side is no longer in charge of message serialization, so it is now decoupled from Bitcoin structures. Only the header is serialized and attached to the payload.
2016-11-25net: No need to check individually for disconnection anymoreCory Fields
2016-11-25Merge #9189: Always add default_witness_commitment with GBT client supportWladimir J. van der Laan
95f4a03 [qa] Test getblocktemplate default_witness_commitment (Suhas Daftuar) ad04d1c Always add default_witness_commitment with GBT client support (Pieter Wuille)
2016-11-23net: don't send any messages before handshake or after requested disconnectCory Fields
Also, send reject messages earlier in SendMessages(), so that disconnections are processed earlier. These changes combined should ensure that no message is ever sent after fDisconnect is set.
2016-11-23net: Set feelers to disconnect at the end of the version messageCory Fields
This way we're not relying on messages going out after fDisconnect has been set. This should not cause any real behavioral changes, though feelers should arguably disconnect earlier in the process. That can be addressed in a later functional change.
2016-11-23Split ::HEADERS processing into two separate cs_main locksMatt Corallo
This will allow NotifyHeaderTip to be called from an AcceptBlockHeader wrapper function without holding cs_main.
2016-11-23Expose AcceptBlockHeader through main.hMatt Corallo
2016-11-23Merge #8930: Move orphan processing to ActivateBestChainPieter Wuille
d2b88f9 Move orphan-conflict removal from main logic into a callback (Matt Corallo) 97e2802 Erase orphans per-transaction instead of per-block (Matt Corallo) ec4525c Move orphan processing to ActivateBestChain (Matt Corallo)
2016-11-23Merge #9199: Always drop the least preferred HB peer when adding a new one.Pieter Wuille
ca8549d Always drop the least preferred HB peer when adding a new one. (Gregory Maxwell)
2016-11-23Move orphan-conflict removal from main logic into a callbackMatt Corallo
This makes the orphan map a part of net-processing logic instead of main logic.
2016-11-23Merge #9196: Send tip change notification from invalidateblockWladimir J. van der Laan
67c6326 Send tip change notification from invalidateblock (Russell Yanofsky)
2016-11-23Merge #8690: Do not fully sort all nodes for addr relayWladimir J. van der Laan
a33b169 Do not fully sort all nodes for addr relay (Pieter Wuille)
2016-11-22Always drop the least preferred HB peer when adding a new one.Gregory Maxwell
When a BIP152 HB-mode peer is in the least preferred position and disconnects, they will not be by ForNode on the next loop. They will continue to sit in that position and prevent deactivating HB mode for peers that are still connected. There is no reason for them to stay in the list if already gone, so drop the first element unconditionally if there are too many. Fixes issue #9163.
2016-11-21Always add default_witness_commitment with GBT client supportPieter Wuille
2016-11-21Merge #8872: Remove block-request logic from INV message processingWladimir J. van der Laan
037159c Remove block-request logic from INV message processing (Matt Corallo) 3451203 [qa] Respond to getheaders and do not assume a getdata on inv (Matt Corallo) d768f15 [qa] Make comptool push blocks instead of relying on inv-fetch (mrbandrews)
2016-11-21Merge #9117: net: don't send feefilter messages before the version handshake ↵Wladimir J. van der Laan
is complete 4662553 net: don't send feefilter messages before the version handshake is complete (Cory Fields)
2016-11-19Introduce convenience type CTransactionRefPieter Wuille
2016-11-19Make CBlock::vtx a vector of shared_ptr<CTransaction>Pieter Wuille
2016-11-18Make orphan parent fetching ask for witnesses.Gregory Maxwell
In 0.13 orphan transactions began being treated as implicit INVs for their parents. But the resulting getdata were not getting the witness flag. This fixes issue #9182 reported by chjj and roasbeef on IRC.
2016-11-17Erase orphans per-transaction instead of per-blockMatt Corallo
2016-11-17Move orphan processing to ActivateBestChainMatt Corallo
This further decouples "main" and "net" processing logic by moving orphan processing out of the chain-connecting cs_main lock and into its own cs_main lock, beside all of the other chain callbacks. Once further decoupling of net and main processing logic occurs, orphan handing should move to its own lock, out of cs_main. Note that this will introduce a race if there are any cases where we assume the orphan map to be consistent with the current chain tip, however I am confident there is no such case (ATMP will fail without DoS score in all such cases).
2016-11-17Merge #9075: Decouple peer-processing-logic from block-connection-logic (#3)Pieter Wuille
ae22357 Replace CValidationState param in ProcessNewBlock with BlockChecked (Matt Corallo) 7c98ce5 Remove pfrom parameter from ProcessNewBlock (Matt Corallo) e2e069d Revert "RPC: Give more details when "generate" fails" (Matt Corallo)
2016-11-14[trivial] Fix hungarian variable nameRussell Yanofsky
Follow up to comment https://github.com/bitcoin/bitcoin/pull/9058#discussion_r87676593
2016-11-11Merge #9058: Fixes for p2p-compactblocks.py test timeouts on travis (#8842)Wladimir J. van der Laan
dac53b5 Modify getblocktxn handler not to drop requests for old blocks (Russell Yanofsky) 55bfddc [qa] Fix stale data bug in test_compactblocks_not_at_tip (Russell Yanofsky) 47e9659 [qa] Fix bug in compactblocks v2 merge (Russell Yanofsky)
2016-11-10Merge #9049: Remove duplicatable duplicate-input check from CheckTransactionWladimir J. van der Laan
e2b3fb3 Optimize vInOutPoints insertion a bit (Matt Corallo) eecffe5 Remove redundant duplicate-input check from CheckTransaction (Matt Corallo) b2e178a Add deserialize + CheckBlock benchmarks, and a full block hex (Matt Corallo)
2016-11-09Optimize vInOutPoints insertion a bitMatt Corallo
2016-11-09Remove redundant duplicate-input check from CheckTransactionMatt Corallo
2016-11-09Replace CValidationState param in ProcessNewBlock with BlockCheckedMatt Corallo
2016-11-09Remove pfrom parameter from ProcessNewBlockMatt Corallo
This further decouples ProcessNewBlock from networking/peer logic.
2016-11-09net: don't send feefilter messages before the version handshake is completeCory Fields
2016-11-09Merge #9039: Various serialization simplifcations and optimizationsWladimir J. van der Laan
d59a518 Use fixed preallocation instead of costly GetSerializeSize (Pieter Wuille) 25a211a Add optimized CSizeComputer serializers (Pieter Wuille) a2929a2 Make CSerAction's ForRead() constexpr (Pieter Wuille) a603925 Avoid -Wshadow errors (Pieter Wuille) 5284721 Get rid of nType and nVersion (Pieter Wuille) 657e05a Make GetSerializeSize a wrapper on top of CSizeComputer (Pieter Wuille) fad9b66 Make nType and nVersion private and sometimes const (Pieter Wuille) c2c5d42 Make streams' read and write return void (Pieter Wuille) 50e8a9c Remove unused ReadVersion and WriteVersion (Pieter Wuille)
2016-11-07Merge #9026: Fix handling of invalid compact blocksPieter Wuille
d4833ff Bump the protocol version to distinguish new banning behavior. (Suhas Daftuar) 88c3549 Fix compact block handling to not ban if block is invalid (Suhas Daftuar) c93beac [qa] Test that invalid compactblocks don't result in ban (Suhas Daftuar)
2016-11-07Remove block-request logic from INV message processingMatt Corallo
2016-11-07Merge #9045: Hash P2P messages as they are received instead of at process-timePieter Wuille
fe1dc62 Hash P2P messages as they are received instead of at process-time (Matt Corallo)
2016-11-07Make GetSerializeSize a wrapper on top of CSizeComputerPieter Wuille
Given that in default GetSerializeSize implementations created by ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid of the specialized GetSerializeSize methods everywhere, and just use CSizeComputer. This removes a lot of code which isn't actually used anywhere. For CCompactSize and CVarInt this actually removes a more efficient size computing algorithm, which is brought back in a later commit.
2016-11-07Modify getblocktxn handler not to drop requests for old blocksRussell Yanofsky
The current getblocktxn implementation drops and ignores requests for old blocks, which causes occasional sync_block timeouts during the p2p-compactblocks.py test as reported in https://github.com/bitcoin/bitcoin/issues/8842. The p2p-compactblocks.py test setup creates many new blocks in a short period of time, which can lead to getblocktxn requests for blocks below the hardcoded depth limit of 10 blocks. This commit changes the getblocktxn handler not to ignore these requests, so the peer nodes in the test setup will reliably be able to sync. The protocol change is documented in BIP-152 update "Allow block responses to getblocktxn requests" at https://github.com/bitcoin/bips/pull/469. The protocol change is not expected to affect nodes running outside the test environment, because there shouldn't normally be lots of new blocks being rapidly added that need to be synced.
2016-11-07Merge #8709: Allow filterclear messages for enabling TX relay only.Wladimir J. van der Laan
1f951c6 Allow filterclear messages for enabling TX relay only. (R E Broadley)