aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/compaction-chain.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-27 09:17:28 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:20 +0800
commitf0405c6a1decc41a878708b0f80e4b6fd6ebbcd5 (patch)
tree286b5ef24b81a4fc595988cfbc2d850a7b272ab4 /vendor/github.com/dexon-foundation/dexon-consensus/core/compaction-chain.go
parente0f7ce1279a832240576e52f2417e82e3d4fc8eb (diff)
downloadgo-tangerine-f0405c6a1decc41a878708b0f80e4b6fd6ebbcd5.tar
go-tangerine-f0405c6a1decc41a878708b0f80e4b6fd6ebbcd5.tar.gz
go-tangerine-f0405c6a1decc41a878708b0f80e4b6fd6ebbcd5.tar.bz2
go-tangerine-f0405c6a1decc41a878708b0f80e4b6fd6ebbcd5.tar.lz
go-tangerine-f0405c6a1decc41a878708b0f80e4b6fd6ebbcd5.tar.xz
go-tangerine-f0405c6a1decc41a878708b0f80e4b6fd6ebbcd5.tar.zst
go-tangerine-f0405c6a1decc41a878708b0f80e4b6fd6ebbcd5.zip
dex: add pull randomness (#105)
* vendor: sync to latest core * dex: Add PullRandomness
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/compaction-chain.go')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/compaction-chain.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/compaction-chain.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/compaction-chain.go
index 14e3b265d..8e044293f 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/compaction-chain.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/compaction-chain.go
@@ -257,3 +257,15 @@ func (cc *compactionChain) lastPendingBlock() *types.Block {
}
return nil
}
+
+func (cc *compactionChain) pendingBlocksWithoutRandomness() (
+ hashes common.Hashes) {
+ cc.lock.RLock()
+ defer cc.lock.RUnlock()
+ for _, block := range cc.pendingBlocks {
+ if _, exist := cc.blockRandomness[block.Hash]; !exist {
+ hashes = append(hashes, block.Hash)
+ }
+ }
+ return
+}