aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/db
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-01-16 13:07:20 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:21 +0800
commit4095f8c34043a2418dece4d5affbceffe0ca55da (patch)
tree458337ca2bd260006f6e22a37db88933da63e06f /vendor/github.com/dexon-foundation/dexon-consensus/core/db
parentea0c0a11ccbefffc2dbb5e323f23997b91239c56 (diff)
downloadgo-tangerine-4095f8c34043a2418dece4d5affbceffe0ca55da.tar
go-tangerine-4095f8c34043a2418dece4d5affbceffe0ca55da.tar.gz
go-tangerine-4095f8c34043a2418dece4d5affbceffe0ca55da.tar.bz2
go-tangerine-4095f8c34043a2418dece4d5affbceffe0ca55da.tar.lz
go-tangerine-4095f8c34043a2418dece4d5affbceffe0ca55da.tar.xz
go-tangerine-4095f8c34043a2418dece4d5affbceffe0ca55da.tar.zst
go-tangerine-4095f8c34043a2418dece4d5affbceffe0ca55da.zip
vendor: sync to latest core (#154)
* vendor: sync to latest core with BA3.0 * params: Update dmoment
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/db')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/db/level-db.go43
1 files changed, 9 insertions, 34 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/db/level-db.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/db/level-db.go
index 75c30372f..1fe29fa10 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/db/level-db.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/db/level-db.go
@@ -72,11 +72,7 @@ func (lvl *LevelDBBackedDB) HasBlock(hash common.Hash) bool {
}
func (lvl *LevelDBBackedDB) internalHasBlock(key []byte) (bool, error) {
- exists, err := lvl.db.Has(key, nil)
- if err != nil {
- return false, err
- }
- return exists, nil
+ return lvl.db.Has(key, nil)
}
// GetBlock implements the Reader.GetBlock method.
@@ -90,9 +86,6 @@ func (lvl *LevelDBBackedDB) GetBlock(
return
}
err = rlp.DecodeBytes(queried, &block)
- if err != nil {
- return
- }
return
}
@@ -113,9 +106,7 @@ func (lvl *LevelDBBackedDB) UpdateBlock(block types.Block) (err error) {
err = ErrBlockDoesNotExist
return
}
- if err = lvl.db.Put(blockKey, marshaled, nil); err != nil {
- return
- }
+ err = lvl.db.Put(blockKey, marshaled, nil)
return
}
@@ -134,9 +125,7 @@ func (lvl *LevelDBBackedDB) PutBlock(block types.Block) (err error) {
err = ErrBlockExists
return
}
- if err = lvl.db.Put(blockKey, marshaled, nil); err != nil {
- return
- }
+ err = lvl.db.Put(blockKey, marshaled, nil)
return
}
@@ -166,10 +155,7 @@ func (lvl *LevelDBBackedDB) PutCompactionChainTipInfo(
if info.Height+1 != height {
return ErrInvalidCompactionChainTipHeight
}
- if err = lvl.db.Put(compactionChainTipInfoKey, marshaled, nil); err != nil {
- return err
- }
- return nil
+ return lvl.db.Put(compactionChainTipInfoKey, marshaled, nil)
}
func (lvl *LevelDBBackedDB) internalGetCompactionChainTipInfo() (
@@ -181,9 +167,7 @@ func (lvl *LevelDBBackedDB) internalGetCompactionChainTipInfo() (
}
return
}
- if err = rlp.DecodeBytes(queried, &info); err != nil {
- return
- }
+ err = rlp.DecodeBytes(queried, &info)
return
}
@@ -201,11 +185,7 @@ func (lvl *LevelDBBackedDB) GetCompactionChainTipInfo() (
// HasDKGPrivateKey check existence of DKG private key of one round.
func (lvl *LevelDBBackedDB) HasDKGPrivateKey(round uint64) (bool, error) {
- exists, err := lvl.db.Has(lvl.getDKGPrivateKeyKey(round), nil)
- if err != nil {
- return false, err
- }
- return exists, nil
+ return lvl.db.Has(lvl.getDKGPrivateKeyKey(round), nil)
}
// GetDKGPrivateKey get DKG private key of one round.
@@ -218,9 +198,7 @@ func (lvl *LevelDBBackedDB) GetDKGPrivateKey(round uint64) (
}
return
}
- if err = rlp.DecodeBytes(queried, &prv); err != nil {
- return
- }
+ err = rlp.DecodeBytes(queried, &prv)
return
}
@@ -239,11 +217,8 @@ func (lvl *LevelDBBackedDB) PutDKGPrivateKey(
if err != nil {
return err
}
- if err := lvl.db.Put(
- lvl.getDKGPrivateKeyKey(round), marshaled, nil); err != nil {
- return err
- }
- return nil
+ return lvl.db.Put(
+ lvl.getDKGPrivateKeyKey(round), marshaled, nil)
}
func (lvl *LevelDBBackedDB) getBlockKey(hash common.Hash) (ret []byte) {