Skip to content

Commit ae96f74

Browse files
committed
remove statedb cache
1 parent 41ab1cd commit ae96f74

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

consensus/cbft/context/context.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"github.com/PlatONnetwork/PlatON-Go/consensus"
66
ctypes "github.com/PlatONnetwork/PlatON-Go/consensus/cbft/types"
7-
"github.com/PlatONnetwork/PlatON-Go/core/state"
87
"github.com/PlatONnetwork/PlatON-Go/p2p/enode"
98
"sync/atomic"
109
"time"
@@ -75,12 +74,12 @@ func (ctx *BlockTimeContext) Deadline() time.Time {
7574
}
7675

7776
type Context struct {
78-
ctx context.Context
79-
backend sdk.Backend
80-
cbft CbftEngine
81-
blockIndex uint32
82-
header *types.Header
83-
statedb atomic.Value
77+
ctx context.Context
78+
backend sdk.Backend
79+
cbft CbftEngine
80+
blockIndex uint32
81+
header *types.Header
82+
//statedb atomic.Value
8483
parentStateDB atomic.Value
8584
}
8685

@@ -129,14 +128,14 @@ func (ctx *Context) Header() *types.Header {
129128
}
130129

131130
func (ctx *Context) StateDB() sdk.StateDBReader {
132-
if ctx.cbft == nil {
133-
return nil
134-
}
135-
if s := ctx.statedb.Load(); s != nil {
136-
return s.(sdk.StateDBReader).(*state.StateDB).NewStateDB()
137-
}
131+
//if ctx.cbft == nil {
132+
// return nil
133+
//}
134+
//if s := ctx.statedb.Load(); s != nil {
135+
// return s.(sdk.StateDBReader).(*state.StateDB).NewStateDB()
136+
//}
138137
state, _ := ctx.cbft.GetState(ctx.Header())
139-
ctx.statedb.Store(state)
138+
//ctx.statedb.Store(state)
140139
return state
141140
}
142141

0 commit comments

Comments
 (0)