aboutsummaryrefslogtreecommitdiffstats
path: root/core/types
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-26 15:56:33 +0800
committerGitHub <noreply@github.com>2018-12-26 15:56:33 +0800
commitca82c3c26ac206c2c81dfa636902aacf327381b1 (patch)
treec708d058e81aae4ae41eb8bb195cf1e64c7739d5 /core/types
parent39c02fe0f7c81491ea897fafcf32595d280bbdbe (diff)
downloaddexon-consensus-ca82c3c26ac206c2c81dfa636902aacf327381b1.tar
dexon-consensus-ca82c3c26ac206c2c81dfa636902aacf327381b1.tar.gz
dexon-consensus-ca82c3c26ac206c2c81dfa636902aacf327381b1.tar.bz2
dexon-consensus-ca82c3c26ac206c2c81dfa636902aacf327381b1.tar.lz
dexon-consensus-ca82c3c26ac206c2c81dfa636902aacf327381b1.tar.xz
dexon-consensus-ca82c3c26ac206c2c81dfa636902aacf327381b1.tar.zst
dexon-consensus-ca82c3c26ac206c2c81dfa636902aacf327381b1.zip
core: Polish randomness (#385)
Diffstat (limited to 'core/types')
-rw-r--r--core/types/block-randomness.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/types/block-randomness.go b/core/types/block-randomness.go
index 1c64d4a..65cb635 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"
@@ -42,3 +43,10 @@ type BlockRandomnessResult struct {
Position Position `json:"position"`
Randomness []byte `json:"randomness"`
}
+
+func (r *BlockRandomnessResult) String() string {
+ return fmt.Sprintf("blockRandomness{Block:%s Pos:%s Rand:%s}",
+ r.BlockHash.String()[:6], &r.Position,
+ hex.EncodeToString(r.Randomness)[:6],
+ )
+}