aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.h
Commit message (Collapse)AuthorAgeFilesLines
* Use C++11 default member initializersMarcoFalke2019-01-051-1/+0
|
* Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|
* Merge #12731: Support serialization as another type without castingWladimir J. van der Laan2018-04-101-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 818dc74 Support serialization as another type without casting (Pieter Wuille) Pull request description: This adds a `READWRITEAS(type, obj)` macro which serializes `obj` as if it were converted to `const type&` when `const`, and to `type&` when non-`const`. No actual cast is involved, so this only works when this conversion can be done automatically. This makes it usable in serialization code that uses a single implementation for both serialization and deserializing, which doesn't know the constness of the object involved. This is a redo of #12712, using a slightly different interface. Tree-SHA512: 262f0257284ff99b5ffaec9b997c194e221522ba35c3ac8eaa9bb344449d7ea0a314de254dc77449fa7aaa600f8cd9a24da65aade8c1ec6aa80c6e9a7bba5ca7
| * Support serialization as another type without castingPieter Wuille2018-03-201-1/+1
| | | | | | | | | | | | | | | | | | This adds a READWRITEAS(type, obj) macro which serializes obj as if it were casted to (const type&) when const, and to (type&) when non-const. This makes it usable in serialization code that uses a single implementation for both serialization and deserializing, which doesn't know the constness of the object involved.
* | Add native support for serializing char arrays without FLATDATAPieter Wuille2018-03-211-3/+3
|/ | | | | | | | | | | | Support is added to serialize arrays of type char or unsigned char directly, without any wrappers. All invocations of the FLATDATA wrappers that are obsoleted by this are removed. This includes a patch by Russell Yanofsky to make char casting type safe. The serialization of CSubNet is changed to serialize a bool directly rather than though FLATDATA. This makes the serialization independent of the size of the bool type (and will use 1 byte everywhere).
* Add setter for g_initial_block_download_completedJonas Schnelli2018-02-171-7/+4
|
* Connect to peers signaling NODE_NETWORK_LIMITED when out-of-IBDJonas Schnelli2018-02-091-0/+5
|
* Accept addresses with NODE_NETWORK_LIMITED flagJonas Schnelli2018-02-091-2/+2
|
* Merge #10498: Use static_cast instead of C-style casts for non-fundamental typesMarcoFalke2018-02-071-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9ad6746ccd Use static_cast instead of C-style casts for non-fundamental types (practicalswift) Pull request description: A C-style cast is equivalent to try casting in the following order: 1. `const_cast(...)` 2. `static_cast(...)` 3. `const_cast(static_cast(...))` 4. `reinterpret_cast(...)` 5. `const_cast(reinterpret_cast(...))` By using `static_cast<T>(...)` explicitly we avoid the possibility of an unintentional and dangerous `reinterpret_cast`. Furthermore `static_cast<T>(...)` allows for easier grepping of casts. For a more thorough discussion, see ["ES.49: If you must use a cast, use a named cast"](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es49-if-you-must-use-a-cast-use-a-named-cast) in the C++ Core Guidelines (Stroustrup & Sutter). Tree-SHA512: bd6349b7ea157da93a47b8cf238932af5dff84731374ccfd69b9f732fabdad1f9b1cdfca67497040f14eaa85346391404f4c0495e22c467f26ca883cd2de4d3c
| * Use static_cast instead of C-style casts for non-fundamental typespracticalswift2017-09-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A C-style cast is equivalent to try casting in the following order: 1. const_cast(...) 2. static_cast(...) 3. const_cast(static_cast(...)) 4. reinterpret_cast(...) 5. const_cast(reinterpret_cast(...)) By using static_cast<T>(...) explicitly we avoid the possibility of an unintentional and dangerous reinterpret_cast. Furthermore static_cast<T>(...) allows for easier grepping of casts.
* | Fix typospracticalswift2018-01-281-1/+1
| |
* | Merge #11512: Use GetDesireableServiceFlags in seeds, dnsseeds, fixing ↵Wladimir J. van der Laan2018-01-241-1/+9
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | static seed adding 2b839ab Update chainparams comment for more info on service bits per dnsseed (Matt Corallo) 62e7642 Fall back to oneshot for DNS Seeds which don't support filtering. (Matt Corallo) 51ae766 Use GetDesireableServiceFlags in static seeds, document this. (Matt Corallo) fb6f6b1 bluematt's testnet-seed now supports x9 (and is just a static list) (Matt Corallo) Pull request description: 4440710 broke inserting entries into addrman from dnsseeds which did not support service bits, as well as static seeds. Static seeds were already being filtered by UA for 0.13.1+ (ie NODE_WITNESS), so simply changing the default service bits to include NODE_WITNESS (and updating docs appropriately) is sufficient. For DNS Seeds, not supporting NODE_WITNESS is no longer useful, so instead use non-filtering seeds as oneshot hosts irrespective of named proxy. I've set my testnet-seed to also support x9, though because it is simply a static host, it may be useful to leave the support off so that it is used as a oneshot to get addresses from a live node instead. I'm fine with either. Tree-SHA512: 3f17d4d2b0b84d876981c962d2b44cb0c8f95f52c56a48c6b35fd882f6d7a40805f320ec452985a1c0b34aebddb1922709156c3ceccd1b9f8363fd7cb537d21d
| * | Use GetDesireableServiceFlags in static seeds, document this.Matt Corallo2018-01-191-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 44407100f broke inserting entries into addrman from static seeds (as well as dnsseeds which did not support service bits). Static seeds were already being filtered by UA for 0.13.1+ (ie NODE_WITNESS), so simply changing the default service bits to include NODE_WITNESS (and updating docs appropriately) is sufficient. For DNS Seeds, we will later fix by falling back to oneshot if a seed does not support filtering.
* | | Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|/ /
* | Add NODE_NETWORK_LIMITED flags and min block amount constantsJonas Schnelli2017-12-051-3/+6
| |
* | scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
* | Merge #10749: Use compile-time constants instead of unnamed enumerations ↵MarcoFalke2017-11-111-10/+7
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (remove "enum hack") 1e65f0f33 Use compile-time constants instead of unnamed enumerations (remove "enum hack") (practicalswift) Pull request description: Use compile-time constants instead of unnamed enumerations (remove "enum hack"). Tree-SHA512: 1b6ebb2755398c5ebab6cce125b1dfc39cbd1504d98d55136b32703fe935c4070360ab3b2f52b1da48ba9f3b01082d204f3d87c92ccb5c8c333731f7f972e128
| * | Use compile-time constants instead of unnamed enumerations (remove "enum hack")practicalswift2017-07-261-10/+7
| | |
* | | Replace relevant services logic with a function suite.Matt Corallo2017-10-131-0/+37
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds HasAllRelevantServices and GetRelevantServices, which check for NETWORK|WITNESS. This changes the following: * Removes nRelevantServices from CConnman, disconnecting it a bit more from protocol-level logic. * Replaces our sometimes-connect-to-!WITNESS-nodes logic with simply always requiring WITNESS|NETWORK for outbound non-feeler connections (feelers still only require NETWORK). * This has the added benefit of removing nServicesExpected from CNode - instead letting net_processing's VERSION message handling simply check HasAllRelevantServices. * This implies we believe WITNESS nodes to continue to be a significant majority of nodes on the network, but also because we cannot sync properly from !WITNESS nodes, it is strange to continue using our valuable outbound slots on them. * In order to prevent this change from preventing connection to -connect= nodes which have !WITNESS, -connect nodes are now given the "addnode" flag. This also allows outbound connections to !NODE_NETWORK nodes for -connect nodes (which was already true of addnodes). * Has the (somewhat unintended) consequence of changing one of the eviction metrics from the same sometimes-connect-to-!WITNESS-nodes metric to requiring HasRelevantServices. This should make NODE_NETWORK_LIMITED much simpler to implement.
* | Declare single-argument (non-converting) constructors "explicit"practicalswift2017-08-161-1/+1
|/ | | | In order to avoid unintended implicit conversions.
* Fix incorrect Doxygen tag (@ince → @since). Make Doxygen parameter names ↵practicalswift2017-07-161-1/+1
| | | | match actual parameter names.
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Minor change to comment above new NODE_WITNESS service flag to keep it ↵Greg Walker2016-11-221-1/+1
| | | | consitent with existing comment structure. Helps with readability.
* Get rid of nType and nVersionPieter Wuille2016-11-071-6/+7
| | | | | | | | | | | Remove the nType and nVersion as parameters to all serialization methods and functions. There is only one place where it's read and has an impact (in CAddress), and even there it does not impact any of the recursively invoked serializers. Instead, the few places that need nType or nVersion are changed to read it directly from the stream object, through GetType() and GetVersion() methods which are added to all stream classes.
* protocol.h: Make enums in GetDataMsg concrete valuesWladimir J. van der Laan2016-10-051-8/+12
| | | | | | | | | This concretizes the numbers and adds a comment to make it clear that these numbers are fixed by the protocol, and may avoid people forgetting to claim numbers in the future (e.g. issue #8500). Also gets rid of a weird unused `MSG_TYPE_MAX` in the middle of the enumeration (thanks @paveljanik for noticing).
* protocol.h: Move MESSAGE_START_SIZE into CMessageHeaderWladimir J. van der Laan2016-10-041-13/+10
| | | | | Also move the enum to the top, and remove a deceptive TODO comment.
* net: Hardcode protocol sizes and use fixed-size typesWladimir J. van der Laan2016-09-281-3/+3
| | | | | The P2P network uses a fixed protocol, these sizes shouldn't change based on what happens to be the architecture.
* net: Consistent checksum handlingWladimir J. van der Laan2016-09-281-2/+2
| | | | | | | | | | | | 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.
* Show XTHIN in GUIR E Broadley2016-08-251-0/+3
|
* net: narrow include scope after moving to netaddressCory Fields2016-07-311-1/+1
| | | | | Net functionality is no longer needed for CAddress/CAddrman/etc. now that CNetAddr/CService/CSubNet are dumb storage classes.
* BIP144: Handshake and relay (receiver side)Pieter Wuille2016-06-221-0/+3
| | | | | | Service bit logic by Nicolas Dorier. Only download blocks from witness peers after fork.
* BIP144: Serialization, hashes, relay (sender side)Pieter Wuille2016-06-221-12/+18
| | | | | | Contains refactorings by Eric Lombrozo. Contains fixup by Nicolas Dorier. Contains cleanup of CInv::GetCommand by Alex Morcos
* Add protocol messages for short-ids blocksMatt Corallo2016-06-191-2/+29
|
* Introduce enum ServiceFlags for service flagsPieter Wuille2016-06-131-4/+8
|
* Don't require services in -addnodePieter Wuille2016-06-131-1/+1
|
* Implement "feefilter" P2P message.Alex Morcos2016-03-211-1/+6
| | | | The "feefilter" p2p message is used to inform other nodes of your mempool min fee which is the feerate that any new transaction must meet to be accepted to your mempool. This will allow them to filter invs to you according to this feerate.
* protocol.h/cpp: Removes NetMsgType::ALERTThomas Kerin2016-03-181-7/+0
|
* Merge pull request #7205Wladimir J. van der Laan2016-01-051-1/+1
|\ | | | | | | | | | | fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke) fa24439 Bump copyright headers to 2015 (MarcoFalke) fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
| * Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
| |
* | net: Add and document network messages in protocol.hWladimir J. van der Laan2015-12-101-0/+159
|/ | | | | | | | | - Avoids string typos (by making the compiler check) - Makes it easier to grep for handling/generation of a certain message type - Refer directly to documentation by following the symbol in IDE - Move list of valid message types to protocol.cpp: protocol.cpp is a more appropriate place for this, and having the array there makes it easier to keep things consistent.
* Add NODE_BLOOM service bit and bump protocol versionMatt Corallo2015-09-051-0/+4
| | | | | | | | | | | | | | | | Lets nodes advertise that they offer bloom filter support explicitly. The protocol version bump allows SPV nodes to assume that NODE_BLOOM is set if NODE_NETWORK is set for pre-70011 nodes. Also adds an option to turn bloom filter support off for nodes which advertise a version number >= 70011. Nodes attempting to use bloom filters on such protocol versions are banned, and a later upgade should drop nodes of an older version which attempt to use bloom filters. Much code stolen from Peter Todd. Implements BIP 111
* nLastTry is only used for addrman entriesPieter Wuille2015-04-191-3/+0
| | | | No need to define it for every CAddress, as it's memory only anyway.
* Add a NODE_GETUTXO service bit and document NODE_NETWORK.Mike Hearn2015-03-211-0/+7
| | | | Stop translating the NODE_* names as they are technical and cannot be translated.
* make CMessageHeader a dumb storage classCory Fields2015-02-251-3/+5
| | | | It shouldn't know or care about bitcoind's chain param selection
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|
* Fix all header definesPavel Janík2014-11-031-3/+3
|
* Apply clang-format on some infrequently-updated filesPieter Wuille2014-09-191-75/+76
|
* Rename IMPLEMENT_SERIALIZE to ADD_SERIALIZE_METHODSPieter Wuille2014-09-021-3/+3
|
* Serializer simplifications after IMPLEMENT_SERIALIZE overhaulPieter Wuille2014-09-011-6/+3
|