Compare commits

..

6 Commits

Author SHA1 Message Date
Elichai Turkel
c198a3839e Fixed DAGToplogy test mock 2021-03-02 20:28:52 +02:00
Elichai Turkel
2cf101de6a Add comments and fix off-by-one in the mergeSetIncrease queue 2021-03-02 20:28:52 +02:00
Elichai Turkel
42ec173726 Check if the new candidate is in the future of any existing candidate 2021-03-02 20:28:52 +02:00
Elichai Turkel
f9ea805fee Add new IsAnyAncestorOf to DagTopolyManager 2021-03-02 20:28:52 +02:00
Elichai Turkel
da5667f84d Remove unneeded Heap/HashSet usages 2021-03-02 20:28:51 +02:00
Elichai Turkel
d2ad34e887 Refactor mergeSetIncrease to return the current BFS block to allow easier merging 2021-03-02 20:28:49 +02:00
3 changed files with 14 additions and 36 deletions

View File

@@ -1,31 +1,11 @@
Kaspad v0.9.0 - 2021-03-04
===========================
* Merge big subdags in pick virtual parents (#1574)
* Write in the reject message the tx rejection reason (#1573)
* Add nil checks for protowire (#1570)
* Increase getBlocks limit to 1000 (#1572)
* Return RPC error if getBlock's lowHash doesn't exist (#1569)
* Add default dns-seeder to testnet (#1568)
* Fix utxoindex deserialization (#1566)
* Add pruning point hash to GetBlockDagInfo response (#1565)
* Use EmitUnpopulated so that kaspactl prints all fields, even the default ones (#1561)
* Stop logging an error whenever an RPC/P2P connection is canceled (#1562)
* Cleanup the logger and make it asynchronous (#1524)
* Close all iterators (#1542)
* Add childrenHashes to GetBlock/s RPC commands (#1560)
* Add ScriptPublicKey.Version to RPC (#1559)
* Fix the target block rate to create less bursty mining (#1554)
Kaspad v0.8.10 - 2021-02-25
===========================
* Fix bug where invalid mempool transactions were not removed (#1551)
* Add RPC reconnection to the miner (#1552)
* Remove virtual diff parents - only selectedTip is virtualDiffParent now (#1550)
* Fix UTXO index (#1548)
* Prevent fast failing (#1545)
* Increase the sleep time in kaspaminer when the node is not synced (#1544)
* Disallow header only blocks on RPC, relay and when requesting IBD full blocks (#1537)
* Make templateManager hold a DomainBlock and isSynced bool instead of a GetBlockTemplateResponseMessage (#1538)
[*] Fix bug where invalid mempool transactions were not removed (#1551)
[*] Add RPC reconnection to the miner (#1552)
[*] Remove virtual diff parents - only selectedTip is virtualDiffParent now (#1550)
[*] Fix UTXO index (#1548)
[*] Prevent fast failing (#1545)
[*] Increase the sleep time in kaspaminer when the node is not synced (#1544)
[*] Disallow header only blocks on RPC, relay and when requesting IBD full blocks (#1537)
[*] Make templateManager hold a DomainBlock and isSynced bool instead of a GetBlockTemplateResponseMessage (#1538)

View File

@@ -45,9 +45,7 @@ func (csm *consensusStateManager) pickVirtualParents(tips []*externalapi.DomainH
end--
}
}
// Limit to maxBlockParents*3 candidates, that way we don't go over thousands of tips when the network isn't healthy.
// There's no specific reason for a factor of 3, and its not a consensus rule, just an estimation saying we probably
// don't want to consider and calculate 3 times the amount of candidates for the set of parents.
// Limit to 30 candidates, that way we don't go over thousands of tips when the network isn't healthy.
if len(candidates) > int(csm.maxBlockParents)*3 {
candidates = candidates[:int(csm.maxBlockParents)*3]
}
@@ -86,7 +84,7 @@ func (csm *consensusStateManager) pickVirtualParents(tips []*externalapi.DomainH
return nil, err
}
candidates = append(candidates, newCandidate)
log.Debugf("Block %s increases merge set too much, instead adding its ancestor %s", candidate, newCandidate)
log.Debugf("Cannot add block %s, instead added new candidate: %s", candidate, newCandidate)
}
boundedMergeBreakingParents, err := csm.boundedMergeBreakingParents(selectedVirtualParents)
@@ -106,7 +104,7 @@ func (csm *consensusStateManager) pickVirtualParents(tips []*externalapi.DomainH
}
}
}
log.Debugf("The virtual parents resolved to be: %s", selectedVirtualParents)
log.Tracef("The virtual parents resolved to be: %s", selectedVirtualParents)
return selectedVirtualParents, nil
}
@@ -195,16 +193,17 @@ func (csm *consensusStateManager) selectVirtualSelectedParent(
}
}
// mergeSetIncrease returns different things depending on the result:
// If the candidate can be a virtual parent then canBeParent=true and mergeSetIncrease=The increase in merge set size
// If the candidate can't be a virtual parent, then canBeParent=false and newCandidate is a new proposed candidate in the past of candidate.
func (csm *consensusStateManager) mergeSetIncrease(candidate *externalapi.DomainHash, selectedVirtualParents []*externalapi.DomainHash, mergeSetSize uint64,
) (canBeParent bool, newCandidate *externalapi.DomainHash, mergeSetIncrease uint64, err error) {
) (canBeParent bool, newCandidate *externalapi.DomainHash, mergeSetIncrease uint64, err error) {
onEnd := logger.LogAndMeasureExecutionTime(log, "mergeSetIncrease")
defer onEnd()
visited := hashset.New()
// Start with the candidate's parents in the queue as we already know the candidate isn't an ancestor of the selectedVirtualParents.
// Start with the parents in the queue as we already know the candidate isn't an ancestor of the parents.
parents, err := csm.dagTopologyManager.Parents(candidate)
if err != nil {
return false, nil, 0, err

View File

@@ -85,7 +85,6 @@ func (x *GetBlocksResponseMessage) toAppMessage() (appmessage.Message, error) {
}
return &appmessage.GetBlocksResponseMessage{
BlockVerboseData: blocksVerboseData,
BlockHashes: x.BlockHashes,
Error: rpcErr,
}, nil
}