diff options
author | Sonic <sonic@dexon.org> | 2018-10-24 20:49:03 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | dbdc956478df94d63af69c28a17e63ecae1235aa (patch) | |
tree | f3654d5609b1fd4c931ee16eb23e67da0c4919b0 /dex | |
parent | 9e33b79d55e3b000c6e986657b5066e2df492afc (diff) | |
download | dexon-dbdc956478df94d63af69c28a17e63ecae1235aa.tar.gz dexon-dbdc956478df94d63af69c28a17e63ecae1235aa.tar.zst dexon-dbdc956478df94d63af69c28a17e63ecae1235aa.zip |
dex: remove useless code
Diffstat (limited to 'dex')
-rw-r--r-- | dex/protocol.go | 115 |
1 files changed, 0 insertions, 115 deletions
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) -} -*/ |