From dbdc956478df94d63af69c28a17e63ecae1235aa Mon Sep 17 00:00:00 2001 From: Sonic Date: Wed, 24 Oct 2018 20:49:03 +0800 Subject: dex: remove useless code --- dex/protocol.go | 115 -------------------------------------------------------- 1 file changed, 115 deletions(-) (limited to 'dex') diff --git a/dex/protocol.go b/dex/protocol.go index aabce3bf9..04928d2b2 100644 --- a/dex/protocol.go +++ b/dex/protocol.go @@ -243,118 +243,3 @@ func rlpHash(x interface{}) (h common.Hash) { hw.Sum(h[:0]) return h } - -/* -type rlpDKGPrivateShare struct { - ProposerID coreTypes.NodeID - ReceiverID coreTypes.NodeID - Round uint64 - PrivateShare []byte - Signature crypto.Signature -} - -func toRLPDKGPrivateShare(ps *coreTypes.DKGPrivateShare) *rlpDKGPrivateShare { - return &rlpDKGPrivateShare{ - ProposerID: ps.ProposerID, - ReceiverID: ps.ReceiverID, - Round: ps.Round, - PrivateShare: ps.PrivateShare.Bytes(), - Signature: ps.Signature, - } -} - -func fromRLPDKGPrivateShare(rps *rlpDKGPrivateShare) *coreTypes.DKGPrivateShare { - ps := &coreTypes.DKGPrivateShare{ - ProposerID: rps.ProposerID, - ReceiverID: rps.ReceiverID, - Round: rps.Round, - Signature: rps.Signature, - } - ps.PrivateShare.SetBytes(rps.PrivateShare) - return ps -} - -type rlpWitness struct { - Timestamp uint64 - Height uint64 - Data []byte -} - -type rlpFinalizeResult struct { - Randomness []byte - Timestamp uint64 - Height uint64 -} - -type rlpLatticeBlock struct { - ProposerID coreTypes.NodeID `json:"proposer_id"` - ParentHash coreCommon.Hash `json:"parent_hash"` - Hash coreCommon.Hash `json:"hash"` - Position coreTypes.Position `json:"position"` - Timestamp uint64 `json:"timestamps"` - Acks coreCommon.SortedHashes `json:"acks"` - Payload []byte `json:"payload"` - Witness rlpWitness - Finalization rlpFinalizeResult - Signature crypto.Signature `json:"signature"` - CRSSignature crypto.Signature `json:"crs_signature"` -} - -func toRLPLatticeBlock(b *coreTypes.Block) *rlpLatticeBlock { - return &rlpLatticeBlock{ - ProposerID: b.ProposerID, - ParentHash: b.ParentHash, - Hash: b.Hash, - Position: b.Position, - Timestamp: toMillisecond(b.Timestamp), - Acks: b.Acks, - Payload: b.Payload, - Witness: rlpWitness{ - Timestamp: toMillisecond(b.Witness.Timestamp), - Height: b.Witness.Height, - Data: b.Witness.Data, - }, - Finalization: rlpFinalizeResult{ - Randomness: b.Finalization.Randomness, - Timestamp: toMillisecond(b.Finalization.Timestamp), - Height: b.Finalization.Height, - }, - Signature: b.Signature, - CRSSignature: b.CRSSignature, - } -} - -func fromRLPLatticeBlock(rb *rlpLatticeBlock) *coreTypes.Block { - return &coreTypes.Block{ - ProposerID: rb.ProposerID, - ParentHash: rb.ParentHash, - Hash: rb.Hash, - Position: rb.Position, - Timestamp: fromMillisecond(rb.Timestamp), - Acks: rb.Acks, - Payload: rb.Payload, - Witness: coreTypes.Witness{ - Timestamp: fromMillisecond(rb.Witness.Timestamp), - Height: rb.Witness.Height, - Data: rb.Witness.Data, - }, - Finalization: coreTypes.FinalizationResult{ - Randomness: rb.Finalization.Randomness, - Timestamp: fromMillisecond(rb.Finalization.Timestamp), - Height: rb.Finalization.Height, - }, - Signature: rb.Signature, - CRSSignature: rb.CRSSignature, - } -} - -func fromMillisecond(s uint64) time.Time { - sec := int64(s / 1000) - nsec := int64((s % 1000) * 1000000) - return time.Unix(sec, nsec) -} - -func toMillisecond(t time.Time) uint64 { - return uint64(t.UnixNano() / 1000000) -} -*/ -- cgit