mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-09-13 21:10:12 +00:00

* Make leveldb cache configurable * Fix leveldb tests * Add a preallocate option to all caches and disable in tests Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
31 lines
563 B
Go
31 lines
563 B
Go
package consensus
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"testing"
|
|
|
|
"github.com/kaspanet/kaspad/domain/dagconfig"
|
|
"github.com/kaspanet/kaspad/infrastructure/db/database/ldb"
|
|
)
|
|
|
|
func TestNewConsensus(t *testing.T) {
|
|
f := NewFactory()
|
|
|
|
dagParams := &dagconfig.DevnetParams
|
|
|
|
tmpDir, err := ioutil.TempDir("", "TestNewConsensus")
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
db, err := ldb.NewLevelDB(tmpDir, 8)
|
|
if err != nil {
|
|
t.Fatalf("error in NewLevelDB: %s", err)
|
|
}
|
|
|
|
_, err = f.NewConsensus(dagParams, db, false)
|
|
if err != nil {
|
|
t.Fatalf("error in NewConsensus: %+v", err)
|
|
}
|
|
}
|