diff options
author | Sonic <sonic@dexon.org> | 2018-10-24 20:49:03 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:53 +0800 |
commit | 39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7 (patch) | |
tree | 7c72536882e90ff876be3a1eef5136b6e7759952 /dex | |
parent | 34e02f038934e1a93cdd2fd68bc877e209a1df99 (diff) | |
download | dexon-39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7.tar dexon-39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7.tar.gz dexon-39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7.tar.bz2 dexon-39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7.tar.lz dexon-39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7.tar.xz dexon-39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7.tar.zst dexon-39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7.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) -} -*/ |