mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
add a simple test to verify DB is the same across different engine versions
This commit is contained in:
parent
ce106abffe
commit
c8ee8e1936
4 changed files with 18 additions and 3 deletions
|
|
@ -72,6 +72,7 @@ func New(config *params.XDPoSConfig, db ethdb.Database) *XDPoS {
|
|||
|
||||
return &XDPoS{
|
||||
config: &conf,
|
||||
db: db,
|
||||
|
||||
signingTxsCache: signingTxsCache,
|
||||
EngineV1: *engine_v1.New(&conf, db),
|
||||
|
|
@ -89,6 +90,7 @@ func NewFaker(db ethdb.Database) *XDPoS {
|
|||
|
||||
fakeEngine = &XDPoS{
|
||||
config: conf,
|
||||
db: db,
|
||||
|
||||
signingTxsCache: signingTxsCache,
|
||||
EngineV1: *engine_v1.NewFaker(db),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,18 @@
|
|||
package XDPoS
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
|
||||
func TestNewAdaptorShallContainMultipleConsensusEngine(t *testing.T) {
|
||||
"github.com/XinFinOrg/XDPoSChain/core/rawdb"
|
||||
"github.com/XinFinOrg/XDPoSChain/params"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAdaptorShouldShareDbWithV1Engine(t *testing.T) {
|
||||
database := rawdb.NewMemoryDatabase()
|
||||
config := params.TestXDPoSMockChainConfig.XDPoS
|
||||
engine := New(config, database)
|
||||
|
||||
assert := assert.New(t)
|
||||
assert.Equal(engine.EngineV1.GetDb(), engine.GetDb())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,13 @@
|
|||
package consensus
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/common"
|
||||
"github.com/XinFinOrg/XDPoSChain/core/state"
|
||||
"github.com/XinFinOrg/XDPoSChain/core/types"
|
||||
"github.com/XinFinOrg/XDPoSChain/params"
|
||||
"github.com/XinFinOrg/XDPoSChain/rpc"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
// ChainReader defines a small collection of methods needed to access the local
|
||||
|
|
|
|||
1
go.sum
1
go.sum
|
|
@ -255,6 +255,7 @@ github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8
|
|||
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639dk2kqnCPPv+wNjq7Xb6EfUxe/oX0/NM=
|
||||
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
|
|
|
|||
Loading…
Reference in a new issue