mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* Add prefix to stores * Add prefix to forgotten stores * Add a special type for prefix * Rename transaction->dbTx * Change error message * Use countKeyName * Rename Temporary Consesnsus to Staging * Add DeleteStagingConsensus to Domain interface * Add lock to staging consensus * Make prefix type-safer * Use ioutil.TempDir instead of t.TempDir
32 lines
642 B
Go
32 lines
642 B
Go
package consensus
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/domain/prefixmanager/prefix"
|
|
"io/ioutil"
|
|
"testing"
|
|
|
|
"github.com/kaspanet/kaspad/domain/dagconfig"
|
|
"github.com/kaspanet/kaspad/infrastructure/db/database/ldb"
|
|
)
|
|
|
|
func TestNewConsensus(t *testing.T) {
|
|
f := NewFactory()
|
|
|
|
config := &Config{Params: 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(config, db, &prefix.Prefix{})
|
|
if err != nil {
|
|
t.Fatalf("error in NewConsensus: %+v", err)
|
|
}
|
|
}
|