mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-03-16 21:34:53 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1111f57398 | ||
|
|
011871cda2 | ||
|
|
7b4f761fb9 | ||
|
|
5806fef35f |
@@ -1,16 +1,13 @@
|
||||
|
||||
Kaspad
|
||||
====
|
||||
Warning: This is pre-alpha software. There's no guarantee anything works.
|
||||
====
|
||||
|
||||
[](https://choosealicense.com/licenses/isc/)
|
||||
[](http://godoc.org/github.com/kaspanet/kaspad)
|
||||
|
||||
Kaspad is the reference full node Kaspa implementation written in Go (golang).
|
||||
|
||||
This project is currently under active development and is in a pre-Alpha state.
|
||||
Some things still don't work and APIs are far from finalized. The code is provided for reference only.
|
||||
This project is currently under active development and is in Beta state.
|
||||
|
||||
## What is kaspa
|
||||
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
Kaspad v0.11.8 - 2021-12-13
|
||||
===========================
|
||||
Bug fixes:
|
||||
* Update reindex root for each block level (#1881)
|
||||
|
||||
Non-breaking changes:
|
||||
* Update readme (#1848)
|
||||
* Lower devnet's initial difficulty (#1869)
|
||||
|
||||
Kaspad v0.11.7 - 2021-12-11
|
||||
===========================
|
||||
Breaking changes:
|
||||
|
||||
@@ -153,7 +153,6 @@ func (f *factory) NewConsensus(config *Config, db infrastructuredatabase.Databas
|
||||
reachabilityDataStore := reachabilityDataStores[0]
|
||||
ghostdagDataStore := ghostdagDataStores[0]
|
||||
|
||||
reachabilityManager := reachabilityManagers[0]
|
||||
dagTopologyManager := dagTopologyManagers[0]
|
||||
ghostdagManager := ghostdagManagers[0]
|
||||
dagTraversalManager := dagTraversalManagers[0]
|
||||
@@ -379,10 +378,9 @@ func (f *factory) NewConsensus(config *Config, db infrastructuredatabase.Databas
|
||||
pruningManager,
|
||||
blockValidator,
|
||||
dagTopologyManager,
|
||||
reachabilityManager,
|
||||
reachabilityManagers,
|
||||
difficultyManager,
|
||||
pastMedianTimeManager,
|
||||
ghostdagManager,
|
||||
coinbaseManager,
|
||||
headerTipsManager,
|
||||
syncManager,
|
||||
|
||||
@@ -21,9 +21,8 @@ type blockProcessor struct {
|
||||
pruningManager model.PruningManager
|
||||
blockValidator model.BlockValidator
|
||||
dagTopologyManager model.DAGTopologyManager
|
||||
reachabilityManager model.ReachabilityManager
|
||||
reachabilityManagers []model.ReachabilityManager
|
||||
difficultyManager model.DifficultyManager
|
||||
ghostdagManager model.GHOSTDAGManager
|
||||
pastMedianTimeManager model.PastMedianTimeManager
|
||||
coinbaseManager model.CoinbaseManager
|
||||
headerTipsManager model.HeadersSelectedTipManager
|
||||
@@ -59,10 +58,9 @@ func New(
|
||||
pruningManager model.PruningManager,
|
||||
blockValidator model.BlockValidator,
|
||||
dagTopologyManager model.DAGTopologyManager,
|
||||
reachabilityManager model.ReachabilityManager,
|
||||
reachabilityManagers []model.ReachabilityManager,
|
||||
difficultyManager model.DifficultyManager,
|
||||
pastMedianTimeManager model.PastMedianTimeManager,
|
||||
ghostdagManager model.GHOSTDAGManager,
|
||||
coinbaseManager model.CoinbaseManager,
|
||||
headerTipsManager model.HeadersSelectedTipManager,
|
||||
syncManager model.SyncManager,
|
||||
@@ -93,10 +91,9 @@ func New(
|
||||
pruningManager: pruningManager,
|
||||
blockValidator: blockValidator,
|
||||
dagTopologyManager: dagTopologyManager,
|
||||
reachabilityManager: reachabilityManager,
|
||||
reachabilityManagers: reachabilityManagers,
|
||||
difficultyManager: difficultyManager,
|
||||
pastMedianTimeManager: pastMedianTimeManager,
|
||||
ghostdagManager: ghostdagManager,
|
||||
coinbaseManager: coinbaseManager,
|
||||
headerTipsManager: headerTipsManager,
|
||||
syncManager: syncManager,
|
||||
|
||||
@@ -254,7 +254,19 @@ func (bp *blockProcessor) updateReachabilityReindexRoot(stagingArea *model.Stagi
|
||||
return nil
|
||||
}
|
||||
|
||||
return bp.reachabilityManager.UpdateReindexRoot(stagingArea, headersSelectedTip)
|
||||
headersSelectedTipHeader, err := bp.blockHeaderStore.BlockHeader(bp.databaseContext, stagingArea, headersSelectedTip)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
headersSelectedTipHeaderBlockLevel := headersSelectedTipHeader.BlockLevel()
|
||||
for blockLevel := 0; blockLevel <= headersSelectedTipHeaderBlockLevel; blockLevel++ {
|
||||
err := bp.reachabilityManagers[blockLevel].UpdateReindexRoot(stagingArea, headersSelectedTip)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bp *blockProcessor) checkBlockStatus(stagingArea *model.StagingArea, block *externalapi.DomainBlock) error {
|
||||
|
||||
@@ -205,32 +205,32 @@ func TestBlockWindow(t *testing.T) {
|
||||
{
|
||||
parents: []string{"H", "F"},
|
||||
id: "I",
|
||||
expectedWindow: []string{"F", "D", "H", "C", "B", "G"},
|
||||
expectedWindow: []string{"F", "D", "H", "C", "G", "B"},
|
||||
},
|
||||
{
|
||||
parents: []string{"I"},
|
||||
id: "J",
|
||||
expectedWindow: []string{"I", "F", "D", "H", "C", "B", "G"},
|
||||
expectedWindow: []string{"I", "F", "D", "H", "C", "G", "B"},
|
||||
},
|
||||
{
|
||||
parents: []string{"J"},
|
||||
id: "K",
|
||||
expectedWindow: []string{"J", "I", "F", "D", "H", "C", "B", "G"},
|
||||
expectedWindow: []string{"J", "I", "F", "D", "H", "C", "G", "B"},
|
||||
},
|
||||
{
|
||||
parents: []string{"K"},
|
||||
id: "L",
|
||||
expectedWindow: []string{"K", "J", "I", "F", "D", "H", "C", "B", "G"},
|
||||
expectedWindow: []string{"K", "J", "I", "F", "D", "H", "C", "G", "B"},
|
||||
},
|
||||
{
|
||||
parents: []string{"L"},
|
||||
id: "M",
|
||||
expectedWindow: []string{"L", "K", "J", "I", "F", "D", "H", "C", "B", "G"},
|
||||
expectedWindow: []string{"L", "K", "J", "I", "F", "D", "H", "C", "G", "B"},
|
||||
},
|
||||
{
|
||||
parents: []string{"M"},
|
||||
id: "N",
|
||||
expectedWindow: []string{"M", "L", "K", "J", "I", "F", "D", "H", "C", "B"},
|
||||
expectedWindow: []string{"M", "L", "K", "J", "I", "F", "D", "H", "C", "G"},
|
||||
},
|
||||
{
|
||||
parents: []string{"N"},
|
||||
|
||||
@@ -129,8 +129,10 @@ func TestDifficulty(t *testing.T) {
|
||||
|
||||
var expectedBits uint32
|
||||
switch consensusConfig.Name {
|
||||
case dagconfig.TestnetParams.Name, dagconfig.DevnetParams.Name:
|
||||
case dagconfig.TestnetParams.Name:
|
||||
expectedBits = uint32(0x1e7f1441)
|
||||
case dagconfig.DevnetParams.Name:
|
||||
expectedBits = uint32(0x207f1441)
|
||||
case dagconfig.MainnetParams.Name:
|
||||
expectedBits = uint32(0x1d02c50f)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestPruning(t *testing.T) {
|
||||
"dag-for-test-pruning.json": {
|
||||
dagconfig.MainnetParams.Name: "503",
|
||||
dagconfig.TestnetParams.Name: "502",
|
||||
dagconfig.DevnetParams.Name: "502",
|
||||
dagconfig.DevnetParams.Name: "503",
|
||||
dagconfig.SimnetParams.Name: "502",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -105,10 +105,7 @@ var devnetGenesisCoinbaseTx = transactionhelper.NewSubnetworkTransaction(0,
|
||||
// devGenesisHash is the hash of the first block in the block DAG for the development
|
||||
// network (genesis block).
|
||||
var devnetGenesisHash = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
|
||||
0x34, 0x3b, 0x53, 0xb7, 0xad, 0x82, 0x8a, 0x33,
|
||||
0x4b, 0x03, 0xb1, 0xbb, 0x13, 0x15, 0xb0, 0x75,
|
||||
0xf3, 0xf0, 0x40, 0xfb, 0x64, 0x0c, 0xca, 0x19,
|
||||
0xc9, 0x61, 0xe7, 0x69, 0xdb, 0x98, 0x98, 0x3e,
|
||||
0x4c, 0x64, 0x16, 0x35, 0xc8, 0x5d, 0xc8, 0x8d, 0x90, 0xbe, 0x2a, 0x42, 0xc1, 0xf6, 0x0f, 0xc4, 0xe9, 0xfc, 0xfc, 0xda, 0xdb, 0x53, 0x0d, 0x51, 0xe3, 0x02, 0x2b, 0x68, 0x65, 0xa6, 0x46, 0x7b,
|
||||
})
|
||||
|
||||
// devnetGenesisMerkleRoot is the hash of the first transaction in the genesis block
|
||||
@@ -130,7 +127,7 @@ var devnetGenesisBlock = externalapi.DomainBlock{
|
||||
&externalapi.DomainHash{},
|
||||
externalapi.NewDomainHashFromByteArray(muhash.EmptyMuHashHash.AsArray()),
|
||||
0x11e9db49828,
|
||||
0x1e7fffff,
|
||||
0x207fffff,
|
||||
0x48e5e,
|
||||
0,
|
||||
0,
|
||||
|
||||
@@ -26,6 +26,7 @@ func mineLoop(syncerRPCClient, syncedRPCClient *rpc.Client) error {
|
||||
return err
|
||||
}
|
||||
log.Infof("Starting to mine")
|
||||
totalTime := time.Duration(0)
|
||||
for i := uint64(0); i < activeConfig().NumberOfBlocks; i++ {
|
||||
log.Infof("Mining block %d...", i+1)
|
||||
err = mineBlock(syncerRPCClient.Address(), miningAddr)
|
||||
@@ -35,12 +36,14 @@ func mineLoop(syncerRPCClient, syncedRPCClient *rpc.Client) error {
|
||||
log.Warnf("mineBlock returned an err: %s", err)
|
||||
}
|
||||
|
||||
const timeToPropagate = 1 * time.Second
|
||||
start := time.Now()
|
||||
const timeToPropagate = 10 * time.Second
|
||||
select {
|
||||
case <-syncedRPCClient.OnBlockAdded:
|
||||
case <-time.After(timeToPropagate):
|
||||
return errors.Errorf("block %d took more than %s to propagate", i+1, timeToPropagate)
|
||||
}
|
||||
totalTime += time.Since(start)
|
||||
|
||||
syncerResult, err := syncerRPCClient.GetBlockDAGInfo()
|
||||
if err != nil {
|
||||
@@ -57,6 +60,12 @@ func mineLoop(syncerRPCClient, syncedRPCClient *rpc.Client) error {
|
||||
}
|
||||
}
|
||||
|
||||
const expectedAveragePropagationTime = time.Second
|
||||
averagePropagationTime := totalTime / time.Duration(activeConfig().NumberOfBlocks)
|
||||
if averagePropagationTime > expectedAveragePropagationTime {
|
||||
return errors.Errorf("average block propagation time %s is higher than expected (%s)", averagePropagationTime, expectedAveragePropagationTime)
|
||||
}
|
||||
|
||||
log.Infof("Finished to mine")
|
||||
|
||||
log.Infof("Getting syncer block count")
|
||||
|
||||
@@ -16,7 +16,7 @@ func TestGetHashrateString(t *testing.T) {
|
||||
var results = map[string]string{
|
||||
dagconfig.MainnetParams.Name: "1.53 GH/s",
|
||||
dagconfig.TestnetParams.Name: "131.07 KH/s",
|
||||
dagconfig.DevnetParams.Name: "131.07 KH/s",
|
||||
dagconfig.DevnetParams.Name: "2 H/s",
|
||||
dagconfig.SimnetParams.Name: "2.00 KH/s",
|
||||
}
|
||||
testutils.ForAllNets(t, false, func(t *testing.T, consensusConfig *consensus.Config) {
|
||||
|
||||
@@ -11,7 +11,7 @@ const validCharacters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrs
|
||||
const (
|
||||
appMajor uint = 0
|
||||
appMinor uint = 11
|
||||
appPatch uint = 7
|
||||
appPatch uint = 8
|
||||
)
|
||||
|
||||
// appBuild is defined as a variable so it can be overridden during the build
|
||||
|
||||
Reference in New Issue
Block a user