diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-12-18 10:02:30 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:19 +0800 |
commit | 70ab62c1b72c6fef8dd2c8e405d7f9823f70f475 (patch) | |
tree | 114f68dd0281d972b18e875c3f34a83af7d5962d /core/rawdb/schema.go | |
parent | aa34cc1069a815ed66ec8fae0988fc4f29687bfd (diff) | |
download | go-tangerine-70ab62c1b72c6fef8dd2c8e405d7f9823f70f475.tar.gz go-tangerine-70ab62c1b72c6fef8dd2c8e405d7f9823f70f475.tar.zst go-tangerine-70ab62c1b72c6fef8dd2c8e405d7f9823f70f475.zip |
vendor: sync to latest core (#91)
- Implement new methods in db to cache DKG
private key.
- Implement new methods in db to cache compaction
chain tip.
Diffstat (limited to 'core/rawdb/schema.go')
-rw-r--r-- | core/rawdb/schema.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/rawdb/schema.go b/core/rawdb/schema.go index 9a820a578..87a56c0ba 100644 --- a/core/rawdb/schema.go +++ b/core/rawdb/schema.go @@ -53,7 +53,9 @@ var ( txLookupPrefix = []byte("l") // txLookupPrefix + hash -> transaction/receipt lookup metadata bloomBitsPrefix = []byte("B") // bloomBitsPrefix + bit (uint16 big endian) + section (uint64 big endian) + hash -> bloom bits - coreBlockPrefix = []byte("D") + coreBlockPrefix = []byte("D") + coreDKGPrivateKeyPrefix = []byte("DPK") + coreCompactionChainTipKey = []byte("CoreChainTip") preimagePrefix = []byte("secure-key-") // preimagePrefix + hash -> preimage configPrefix = []byte("ethereum-config-") // config prefix for the db @@ -120,6 +122,14 @@ func coreBlockKey(hash common.Hash) []byte { return append(coreBlockPrefix, hash.Bytes()...) } +// coreDKGPrivateKeyKey = coreDKGPrivateKeyPrefix + round +func coreDKGPrivateKeyKey(round uint64) []byte { + ret := make([]byte, len(coreDKGPrivateKeyPrefix)+8) + copy(ret, coreDKGPrivateKeyPrefix) + binary.LittleEndian.PutUint64(ret[len(coreDKGPrivateKeyPrefix):], round) + return ret +} + // bloomBitsKey = bloomBitsPrefix + bit (uint16 big endian) + section (uint64 big endian) + hash func bloomBitsKey(bit uint, section uint64, hash common.Hash) []byte { key := append(append(bloomBitsPrefix, make([]byte, 10)...), hash.Bytes()...) |