aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice-data.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-13 11:12:59 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:19 +0800
commitaa34cc1069a815ed66ec8fae0988fc4f29687bfd (patch)
treef771aed8714ed77d540f4c41578df94605aef03b /vendor/github.com/dexon-foundation/dexon-consensus/core/lattice-data.go
parent7a587feaa582fcecdcc0388f720e54614cb6b8f4 (diff)
downloadgo-tangerine-aa34cc1069a815ed66ec8fae0988fc4f29687bfd.tar
go-tangerine-aa34cc1069a815ed66ec8fae0988fc4f29687bfd.tar.gz
go-tangerine-aa34cc1069a815ed66ec8fae0988fc4f29687bfd.tar.bz2
go-tangerine-aa34cc1069a815ed66ec8fae0988fc4f29687bfd.tar.lz
go-tangerine-aa34cc1069a815ed66ec8fae0988fc4f29687bfd.tar.xz
go-tangerine-aa34cc1069a815ed66ec8fae0988fc4f29687bfd.tar.zst
go-tangerine-aa34cc1069a815ed66ec8fae0988fc4f29687bfd.zip
vendor: sync to latest core and fix conflict
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/lattice-data.go')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/lattice-data.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice-data.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice-data.go
index f1ab2de6a..e55c0dbfc 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice-data.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice-data.go
@@ -24,7 +24,7 @@ import (
"time"
"github.com/dexon-foundation/dexon-consensus/common"
- "github.com/dexon-foundation/dexon-consensus/core/blockdb"
+ "github.com/dexon-foundation/dexon-consensus/core/db"
"github.com/dexon-foundation/dexon-consensus/core/types"
"github.com/dexon-foundation/dexon-consensus/core/utils"
)
@@ -105,8 +105,8 @@ func newLatticeDataConfig(
// latticeData is a module for storing lattice.
type latticeData struct {
- // BlockDB for getting blocks purged in memory.
- db blockdb.Reader
+ // DB for getting blocks purged in memory.
+ db db.Reader
// chains stores chains' blocks and other info.
chains []*chainStatus
// blockByHash stores blocks, indexed by block hash.
@@ -117,7 +117,7 @@ type latticeData struct {
// newLatticeData creates a new latticeData instance.
func newLatticeData(
- db blockdb.Reader,
+ db db.Reader,
dMoment time.Time,
round uint64,
config *types.Config) (data *latticeData) {
@@ -146,7 +146,7 @@ func (data *latticeData) checkAckingRelations(b *types.Block) error {
for _, hash := range b.Acks {
bAck, err := data.findBlock(hash)
if err != nil {
- if err == blockdb.ErrBlockDoesNotExist {
+ if err == db.ErrBlockDoesNotExist {
return &ErrAckingBlockNotExists{hash}
}
return err
@@ -276,7 +276,7 @@ func (data *latticeData) addBlock(
// Update lastAckPos.
for _, ack := range block.Acks {
if bAck, err = data.findBlock(ack); err != nil {
- if err == blockdb.ErrBlockDoesNotExist {
+ if err == db.ErrBlockDoesNotExist {
err = nil
continue
}
@@ -298,7 +298,7 @@ func (data *latticeData) addBlock(
allAckingBlockDelivered := true
for _, ack := range tip.Acks {
if bAck, err = data.findBlock(ack); err != nil {
- if err == blockdb.ErrBlockDoesNotExist {
+ if err == db.ErrBlockDoesNotExist {
err = nil
allAckingBlockDelivered = false
break
@@ -525,7 +525,7 @@ func (data *latticeData) findBlock(h common.Hash) (b *types.Block, err error) {
return
}
var tmpB types.Block
- if tmpB, err = data.db.Get(h); err != nil {
+ if tmpB, err = data.db.GetBlock(h); err != nil {
return
}
b = &tmpB
@@ -632,7 +632,7 @@ func (s *chainStatus) addBlock(b *types.Block) {
}
// purgeBlock purges a block from cache, make sure this block is already saved
-// in blockdb.
+// in db.
func (s *chainStatus) purgeBlock(b *types.Block) error {
if b.Hash != s.blocks[0].Hash || s.nextOutputIndex <= 0 {
return ErrPurgeNotDeliveredBlock