// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
packagep2p
// This file defines the structure for the protocol which is a msgp encoded ( which is standard)
// msgp would cause an easy rewrite of p2p layer even in c, ruby or rust etc as future may demand
// the protocol is length prefixed msgp payload
// though we can use http2 stream features, they may become compilcated as the project evolves
// the prefix length is 4 bytes, little endian encoded ( so a frame can be 4GB in size)
// this is Work-In-Progress
// the reason for writing it from scratch is the mess of boost serialisation
// the p2p package is currently the most complex within the entire project
// the protocol is partly syncronous, partly asyncronous , except for first handshake, so the node remain undetectable to external network scans, the detection cost is atleast send a handshake packet*/
// these are the commands required to make it completely operational
constV2_COMMAND_NULL=0// default value is zero and is a null command
//const V2_COMMAND_NULL = 0
//first 40 are reserved for future use
constV2_COMMAND_HANDSHAKE=41// commands are syncronous and must be responded within 10 secs
constV2_COMMAND_SYNC=42
constV2_COMMAND_CHAIN_REQUEST=43
constV2_COMMAND_CHAIN_RESPONSE=44
constV2_COMMAND_OBJECTS_REQUEST=45
constV2_COMMAND_OBJECTS_RESPONSE=46
constV2_NOTIFY_NEW_BLOCK=0xff// Notifications are asyncronous all notifications come here, such as new block, new txs