diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-26 11:59:24 +0800 |
---|---|---|
committer | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-27 15:25:10 +0800 |
commit | 7783bc4ba52bfc534d5b4d91e78abb2ddad7d078 (patch) | |
tree | f57ea6f4d8b2faa23ab95691717b071f507e621f /core/types/block-randomness.go | |
parent | b8ced165b1fb03394f8758e08148b0e5d06aa07b (diff) | |
download | dexon-consensus-7783bc4ba52bfc534d5b4d91e78abb2ddad7d078.tar dexon-consensus-7783bc4ba52bfc534d5b4d91e78abb2ddad7d078.tar.gz dexon-consensus-7783bc4ba52bfc534d5b4d91e78abb2ddad7d078.tar.bz2 dexon-consensus-7783bc4ba52bfc534d5b4d91e78abb2ddad7d078.tar.lz dexon-consensus-7783bc4ba52bfc534d5b4d91e78abb2ddad7d078.tar.xz dexon-consensus-7783bc4ba52bfc534d5b4d91e78abb2ddad7d078.tar.zst dexon-consensus-7783bc4ba52bfc534d5b4d91e78abb2ddad7d078.zip |
core: bring back agreement result (#515)
* core: bring back agreement result
* add logger
* Fix
* fixup
Diffstat (limited to 'core/types/block-randomness.go')
-rw-r--r-- | core/types/block-randomness.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/types/block-randomness.go b/core/types/block-randomness.go index a3ba631..b87e8a1 100644 --- a/core/types/block-randomness.go +++ b/core/types/block-randomness.go @@ -18,6 +18,7 @@ package types import ( + "encoding/hex" "fmt" "github.com/dexon-foundation/dexon-consensus/common" @@ -30,9 +31,15 @@ type AgreementResult struct { Votes []Vote `json:"votes"` IsEmptyBlock bool `json:"is_empty_block"` FinalizationHeight uint64 `json:"finalization_height"` + Randomness []byte `json:"randomness"` } func (r *AgreementResult) String() string { - return fmt.Sprintf("agreementResult{Block:%s Pos:%s}", - r.BlockHash.String()[:6], r.Position) + if len(r.Randomness) == 0 { + return fmt.Sprintf("agreementResult{Block:%s Pos:%s}", + r.BlockHash.String()[:6], r.Position) + } + return fmt.Sprintf("agreementResult{Block:%s Pos:%s Rand:%s}", + r.BlockHash.String()[:6], r.Position, + hex.EncodeToString(r.Randomness)[:6]) } |