Skip to content

Commit 41ab1cd

Browse files
committed
copy statedb every time use it
1 parent e993b85 commit 41ab1cd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

consensus/cbft/context/context.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ 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"
78
"github.com/PlatONnetwork/PlatON-Go/p2p/enode"
89
"sync/atomic"
910
"time"
@@ -132,7 +133,7 @@ func (ctx *Context) StateDB() sdk.StateDBReader {
132133
return nil
133134
}
134135
if s := ctx.statedb.Load(); s != nil {
135-
return s.(types.StateDBReader)
136+
return s.(sdk.StateDBReader).(*state.StateDB).NewStateDB()
136137
}
137138
state, _ := ctx.cbft.GetState(ctx.Header())
138139
ctx.statedb.Store(state)

0 commit comments

Comments
 (0)