[WIP] Partial Transition from Writeable/Readable to Codecs (#51)

* Sample Signatures for put_enc and get_dec
* Implement put_enc and get_dec
* Implement ChainCodec in grin_chain
* Truncate src only on complete Blocks
* Truncate src only on complete Tip + Check Len
* Move BlockHeader Encoding to BlockHeaderCodec
* Define put_enc for store::Batch
* Replace BlockCodec and BlockHeaderCodec with generic BlockCodec<T>
* Implement Default for BlockCodec Manually
* Replace get_ser/put_ser with get_enc/get_dec for chain::ChainKVStore
* Remove Writeable/Readable for chain::Tip
* Add Tokio-io and Bytes to grin_p2p
* Additional Setup for Message enum + Msg{Encode,Decode} traits
* base msg ping pong encoding and test
* fill out msg-codec tests
* Implement Hand Encoding/Decoding
* msg-encode shake
* msg-encode getpeeraddr
* codec peer-addrs message, SockAddr struct wierdness
* header message codec
* msg encoding finished prelim
* Implement PeerCodec Encoding/Decoding
* Set PeerStore to use PeerCodec for Encoding/Decoding
* Add a DecIterator
* Prune PeerStore
* Replace Decoding and Encoding in handle_payload
* Prune Writeable/Readable methods in store::Store
* Remove Incomplete Frame Testing ( Not Nessesary right now )
* separate block and tx codec tests
* Refactor {Tx,Block}Codec Tests
This commit is contained in:
Jacob Payne
2017-05-22 10:16:13 -07:00
committed by Ignotus Peverell
parent a402f39633
commit de4ebdde71
21 changed files with 1789 additions and 469 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ bitflags! {
}
/// Block header, fairly standard compared to other blockchains.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct BlockHeader {
/// Height of this block since the genesis block (height 0)
pub height: u64,
@@ -139,7 +139,7 @@ impl Readable for BlockHeader {
/// non-explicit, assumed to be deducible from block height (similar to
/// bitcoin's schedule) and expressed as a global transaction fee (added v.H),
/// additive to the total of fees ever collected.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct Block {
/// The header with metadata and commitments to the rest of the data
pub header: BlockHeader,
+4 -4
View File
@@ -37,7 +37,7 @@ bitflags! {
/// Pedersen commitment and the signature, that guarantees that the commitments
/// amount to zero. The signature signs the fee, which is retained for
/// signature validation.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub struct TxKernel {
/// Options for a kernel's structure or use
pub features: KernelFeatures,
@@ -88,7 +88,7 @@ impl TxKernel {
}
/// A transaction
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub struct Transaction {
/// Set of inputs spent by the transaction.
pub inputs: Vec<Input>,
@@ -239,7 +239,7 @@ impl Transaction {
/// A transaction input, mostly a reference to an output being spent by the
/// transaction.
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Input(pub Commitment);
/// Implementation of Writeable for a transaction Input, defines how to write
@@ -282,7 +282,7 @@ bitflags! {
/// range
/// proof guarantees the commitment includes a positive value without overflow
/// and the ownership of the private key.
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Output {
/// Options for an output's structure or use
pub features: OutputFeatures,