mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-02-23 20:03:16 +00:00
Compare commits
11 Commits
rm
...
v0.9.2-rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1334454e4f | ||
|
|
d80144ef15 | ||
|
|
11bd3a7e3f | ||
|
|
e457503aea | ||
|
|
c6c63c7ff9 | ||
|
|
dd91ffb7d8 | ||
|
|
921ca19b42 | ||
|
|
98c2dc8189 | ||
|
|
37654156a6 | ||
|
|
0271858f25 | ||
|
|
7909480757 |
77
.github/workflows/go-deploy.yml
vendored
Normal file
77
.github/workflows/go-deploy.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
name: Build and Upload assets
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||
name: Building For ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Fix windows CRLF
|
||||
run: git config --global core.autocrlf false
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# We need to increase the page size because the tests run out of memory on github CI windows.
|
||||
# Use the powershell script from this github action: https://github.com/al-cheb/configure-pagefile-action/blob/master/scripts/SetPageFileSize.ps1
|
||||
# MIT License (MIT) Copyright (c) 2020 Maxim Lobanov and contributors
|
||||
- name: Increase page size on windows
|
||||
if: runner.os == 'Windows'
|
||||
shell: powershell
|
||||
run: powershell -command .\.github\workflows\SetPageFileSize.ps1
|
||||
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
|
||||
- name: Build on linux
|
||||
if: runner.os == 'Linux'
|
||||
# `-extldflags=-static` - means static link everything, `-tags netgo,osusergo` means use pure go replacements for "os/user" and "net"
|
||||
# `-s -w` strips the binary to produce smaller size binaries
|
||||
run: |
|
||||
go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o ./bin/ ./...
|
||||
archive="bin/kaspad-${{ github.event.release.tag_name }}-linux.zip"
|
||||
asset_name="kaspad-${{ github.event.release.tag_name }}-linux.zip"
|
||||
zip -r "${archive}" ./bin/*
|
||||
echo "archive=${archive}" >> $GITHUB_ENV
|
||||
echo "asset_name=${asset_name}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build on Windows
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
go build -v -ldflags="-s -w" -o bin/ ./...
|
||||
archive="bin/kaspad-${{ github.event.release.tag_name }}-win64.zip"
|
||||
asset_name="kaspad-${{ github.event.release.tag_name }}-win64.zip"
|
||||
powershell "Compress-Archive bin/* \"${archive}\""
|
||||
echo "archive=${archive}" >> $GITHUB_ENV
|
||||
echo "asset_name=${asset_name}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build on MacOS
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
go build -v -ldflags="-s -w" -o ./bin/ ./...
|
||||
archive="bin/kaspad-${{ github.event.release.tag_name }}-osx.zip"
|
||||
asset_name="kaspad-${{ github.event.release.tag_name }}-osx.zip"
|
||||
zip -r "${archive}" ./bin/*
|
||||
echo "archive=${archive}" >> $GITHUB_ENV
|
||||
echo "asset_name=${asset_name}" >> $GITHUB_ENV
|
||||
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: "./${{ env.archive }}"
|
||||
asset_name: "${{ env.asset_name }}"
|
||||
asset_content_type: application/zip
|
||||
@@ -238,7 +238,7 @@ func (m *Manager) registerTransactionRelayFlow(router *routerpkg.Router, isStopp
|
||||
outgoingRoute := router.OutgoingRoute()
|
||||
|
||||
return []*flow{
|
||||
m.registerFlow("HandleRelayedTransactions", router,
|
||||
m.registerFlowWithCapacity("HandleRelayedTransactions", 10_000, router,
|
||||
[]appmessage.MessageCommand{appmessage.CmdInvTransaction, appmessage.CmdTx, appmessage.CmdTransactionNotFound}, isStopping, errChan,
|
||||
func(incomingRoute *routerpkg.Route, peer *peerpkg.Peer) error {
|
||||
return transactionrelay.HandleRelayedTransactions(m.context, incomingRoute, outgoingRoute)
|
||||
@@ -274,6 +274,24 @@ func (m *Manager) registerFlow(name string, router *routerpkg.Router, messageTyp
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return m.registerFlowForRoute(route, name, isStopping, errChan, initializeFunc)
|
||||
}
|
||||
|
||||
func (m *Manager) registerFlowWithCapacity(name string, capacity int, router *routerpkg.Router,
|
||||
messageTypes []appmessage.MessageCommand, isStopping *uint32,
|
||||
errChan chan error, initializeFunc flowInitializeFunc) *flow {
|
||||
|
||||
route, err := router.AddIncomingRouteWithCapacity(capacity, messageTypes)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return m.registerFlowForRoute(route, name, isStopping, errChan, initializeFunc)
|
||||
}
|
||||
|
||||
func (m *Manager) registerFlowForRoute(route *routerpkg.Route, name string, isStopping *uint32,
|
||||
errChan chan error, initializeFunc flowInitializeFunc) *flow {
|
||||
|
||||
return &flow{
|
||||
name: name,
|
||||
executeFunc: func(peer *peerpkg.Peer) {
|
||||
|
||||
@@ -1,11 +1,35 @@
|
||||
|
||||
Kaspad v0.9.1 - 2021-03-14
|
||||
===========================
|
||||
* Testnet network reset
|
||||
|
||||
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)
|
||||
|
||||
@@ -11,6 +11,7 @@ type DAGTopologyManager interface {
|
||||
IsChildOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error)
|
||||
IsAncestorOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error)
|
||||
IsAncestorOfAny(blockHash *externalapi.DomainHash, potentialDescendants []*externalapi.DomainHash) (bool, error)
|
||||
IsAnyAncestorOf(potentialAncestors []*externalapi.DomainHash, blockHash *externalapi.DomainHash) (bool, error)
|
||||
IsInSelectedParentChainOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error)
|
||||
ChildInSelectedParentChainOf(context, highHash *externalapi.DomainHash) (*externalapi.DomainHash, error)
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ func (csm *consensusStateManager) pickVirtualParents(tips []*externalapi.DomainH
|
||||
}
|
||||
log.Debugf("The selected parent of the virtual is: %s", virtualSelectedParent)
|
||||
|
||||
selectedVirtualParents := hashset.NewFromSlice(virtualSelectedParent)
|
||||
candidates := candidatesHeap.ToSlice()
|
||||
// prioritize half the blocks with highest blueWork and half with lowest, so the network will merge splits faster.
|
||||
if len(candidates) >= int(csm.maxBlockParents) {
|
||||
@@ -46,7 +45,14 @@ 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.
|
||||
if len(candidates) > int(csm.maxBlockParents)*3 {
|
||||
candidates = candidates[:int(csm.maxBlockParents)*3]
|
||||
}
|
||||
|
||||
selectedVirtualParents := []*externalapi.DomainHash{virtualSelectedParent}
|
||||
mergeSetSize := uint64(1) // starts counting from 1 because selectedParent is already in the mergeSet
|
||||
|
||||
for len(candidates) > 0 && uint64(len(selectedVirtualParents)) < uint64(csm.maxBlockParents) {
|
||||
@@ -56,32 +62,68 @@ func (csm *consensusStateManager) pickVirtualParents(tips []*externalapi.DomainH
|
||||
log.Debugf("Attempting to add %s to the virtual parents", candidate)
|
||||
log.Debugf("The current merge set size is %d", mergeSetSize)
|
||||
|
||||
mergeSetIncrease, err := csm.mergeSetIncrease(candidate, selectedVirtualParents)
|
||||
canBeParent, newCandidate, mergeSetIncrease, err := csm.mergeSetIncrease(candidate, selectedVirtualParents, mergeSetSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Debugf("The merge set would increase by %d with block %s", mergeSetIncrease, candidate)
|
||||
|
||||
if mergeSetSize+mergeSetIncrease > csm.mergeSetSizeLimit {
|
||||
log.Debugf("Cannot add block %s since that would violate the merge set size limit", candidate)
|
||||
if canBeParent {
|
||||
mergeSetSize += mergeSetIncrease
|
||||
selectedVirtualParents = append(selectedVirtualParents, candidate)
|
||||
log.Tracef("Added block %s to the virtual parents set", candidate)
|
||||
continue
|
||||
}
|
||||
|
||||
selectedVirtualParents.Add(candidate)
|
||||
mergeSetSize += mergeSetIncrease
|
||||
log.Tracef("Added block %s to the virtual parents set", candidate)
|
||||
// If we already have a candidate in the past of newCandidate then skip.
|
||||
isInFutureOfCandidates, err := csm.dagTopologyManager.IsAnyAncestorOf(candidates, newCandidate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if isInFutureOfCandidates {
|
||||
continue
|
||||
}
|
||||
// Remove all candidates in the future of newCandidate
|
||||
candidates, err = csm.removeHashesInFutureOf(candidates, newCandidate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
candidates = append(candidates, newCandidate)
|
||||
log.Debugf("Block %s increases merge set too much, instead adding its ancestor %s", candidate, newCandidate)
|
||||
}
|
||||
|
||||
boundedMergeBreakingParents, err := csm.boundedMergeBreakingParents(selectedVirtualParents.ToSlice())
|
||||
boundedMergeBreakingParents, err := csm.boundedMergeBreakingParents(selectedVirtualParents)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Tracef("The following parents are omitted for "+
|
||||
"breaking the bounded merge set: %s", boundedMergeBreakingParents)
|
||||
|
||||
virtualParents := selectedVirtualParents.Subtract(boundedMergeBreakingParents).ToSlice()
|
||||
log.Tracef("The virtual parents resolved to be: %s", virtualParents)
|
||||
return virtualParents, nil
|
||||
// Remove all boundedMergeBreakingParents from selectedVirtualParents
|
||||
for _, breakingParent := range boundedMergeBreakingParents {
|
||||
for i, parent := range selectedVirtualParents {
|
||||
if parent.Equal(breakingParent) {
|
||||
selectedVirtualParents[i] = selectedVirtualParents[len(selectedVirtualParents)-1]
|
||||
selectedVirtualParents = selectedVirtualParents[:len(selectedVirtualParents)-1]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Debugf("The virtual parents resolved to be: %s", selectedVirtualParents)
|
||||
return selectedVirtualParents, nil
|
||||
}
|
||||
|
||||
func (csm *consensusStateManager) removeHashesInFutureOf(hashes []*externalapi.DomainHash, ancestor *externalapi.DomainHash) ([]*externalapi.DomainHash, error) {
|
||||
// Source: https://github.com/golang/go/wiki/SliceTricks#filter-in-place
|
||||
i := 0
|
||||
for _, hash := range hashes {
|
||||
isInFutureOfAncestor, err := csm.dagTopologyManager.IsAncestorOf(ancestor, hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !isInFutureOfAncestor {
|
||||
hashes[i] = hash
|
||||
i++
|
||||
}
|
||||
}
|
||||
return hashes[:i], nil
|
||||
}
|
||||
|
||||
func (csm *consensusStateManager) selectVirtualSelectedParent(
|
||||
@@ -153,59 +195,66 @@ func (csm *consensusStateManager) selectVirtualSelectedParent(
|
||||
}
|
||||
}
|
||||
|
||||
func (csm *consensusStateManager) mergeSetIncrease(
|
||||
candidate *externalapi.DomainHash, selectedVirtualParents hashset.HashSet) (uint64, error) {
|
||||
|
||||
// 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) {
|
||||
onEnd := logger.LogAndMeasureExecutionTime(log, "mergeSetIncrease")
|
||||
defer onEnd()
|
||||
|
||||
visited := hashset.New()
|
||||
queue := csm.dagTraversalManager.NewDownHeap()
|
||||
err := queue.Push(candidate)
|
||||
// Start with the candidate's parents in the queue as we already know the candidate isn't an ancestor of the selectedVirtualParents.
|
||||
parents, err := csm.dagTopologyManager.Parents(candidate)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return false, nil, 0, err
|
||||
}
|
||||
mergeSetIncrease := uint64(1) // starts with 1 for the candidate itself
|
||||
for _, parent := range parents {
|
||||
visited.Add(parent)
|
||||
}
|
||||
queue := parents
|
||||
mergeSetIncrease = uint64(1) // starts with 1 for the candidate itself
|
||||
|
||||
for queue.Len() > 0 {
|
||||
current := queue.Pop()
|
||||
var current *externalapi.DomainHash
|
||||
for len(queue) > 0 {
|
||||
current, queue = queue[0], queue[1:]
|
||||
log.Tracef("Attempting to increment the merge set size increase for block %s", current)
|
||||
|
||||
isInPastOfSelectedVirtualParents, err := csm.dagTopologyManager.IsAncestorOfAny(
|
||||
current, selectedVirtualParents.ToSlice())
|
||||
isInPastOfSelectedVirtualParents, err := csm.dagTopologyManager.IsAncestorOfAny(current, selectedVirtualParents)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return false, nil, 0, err
|
||||
}
|
||||
if isInPastOfSelectedVirtualParents {
|
||||
log.Tracef("Skipping block %s because it's in the past of one "+
|
||||
"(or more) of the selected virtual parents", current)
|
||||
log.Tracef("Skipping block %s because it's in the past of one (or more) of the selected virtual parents", current)
|
||||
continue
|
||||
}
|
||||
|
||||
log.Tracef("Incrementing the merge set size increase")
|
||||
mergeSetIncrease++
|
||||
|
||||
if (mergeSetSize + mergeSetIncrease) > csm.mergeSetSizeLimit {
|
||||
log.Debugf("The merge set would increase by more than the limit with block %s", candidate)
|
||||
return false, current, mergeSetIncrease, nil
|
||||
}
|
||||
|
||||
parents, err := csm.dagTopologyManager.Parents(current)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return false, nil, 0, err
|
||||
}
|
||||
for _, parent := range parents {
|
||||
if !visited.Contains(parent) {
|
||||
visited.Add(parent)
|
||||
err = queue.Push(parent)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
queue = append(queue, parent)
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Debugf("The resolved merge set size increase is: %d", mergeSetIncrease)
|
||||
|
||||
return mergeSetIncrease, nil
|
||||
return true, nil, mergeSetIncrease, nil
|
||||
}
|
||||
|
||||
func (csm *consensusStateManager) boundedMergeBreakingParents(
|
||||
parents []*externalapi.DomainHash) (hashset.HashSet, error) {
|
||||
parents []*externalapi.DomainHash) ([]*externalapi.DomainHash, error) {
|
||||
|
||||
onEnd := logger.LogAndMeasureExecutionTime(log, "boundedMergeBreakingParents")
|
||||
defer onEnd()
|
||||
@@ -271,7 +320,7 @@ func (csm *consensusStateManager) boundedMergeBreakingParents(
|
||||
}
|
||||
}
|
||||
|
||||
boundedMergeBreakingParents := hashset.New()
|
||||
var boundedMergeBreakingParents []*externalapi.DomainHash
|
||||
for _, parent := range parents {
|
||||
log.Debugf("Checking whether parent %s breaks the bounded merge set", parent)
|
||||
isBadRedInPast := false
|
||||
@@ -287,7 +336,7 @@ func (csm *consensusStateManager) boundedMergeBreakingParents(
|
||||
}
|
||||
if isBadRedInPast {
|
||||
log.Debugf("Adding parent %s to the bounded merge breaking parents set", parent)
|
||||
boundedMergeBreakingParents.Add(parent)
|
||||
boundedMergeBreakingParents = append(boundedMergeBreakingParents, parent)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,22 @@ func (dtm *dagTopologyManager) IsAncestorOfAny(blockHash *externalapi.DomainHash
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsAnyAncestorOf returns true if at least one of `potentialAncestors` is an ancestor of `blockHash`
|
||||
func (dtm *dagTopologyManager) IsAnyAncestorOf(potentialAncestors []*externalapi.DomainHash, blockHash *externalapi.DomainHash) (bool, error) {
|
||||
for _, potentialAncestor := range potentialAncestors {
|
||||
isAncestorOf, err := dtm.IsAncestorOf(potentialAncestor, blockHash)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if isAncestorOf {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// IsInSelectedParentChainOf returns true if blockHashA is in the selected parent chain of blockHashB
|
||||
func (dtm *dagTopologyManager) IsInSelectedParentChainOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) {
|
||||
return dtm.reachabilityManager.IsReachabilityTreeAncestorOf(blockHashA, blockHashB)
|
||||
|
||||
@@ -130,37 +130,37 @@ func TestBlockWindow(t *testing.T) {
|
||||
{
|
||||
parents: []string{"H", "F"},
|
||||
id: "I",
|
||||
expectedWindowWithGenesisPadding: []string{"F", "H", "C", "D", "B", "G", "A", "A", "A", "A"},
|
||||
expectedWindowWithGenesisPadding: []string{"F", "C", "H", "D", "G", "B", "A", "A", "A", "A"},
|
||||
},
|
||||
{
|
||||
parents: []string{"I"},
|
||||
id: "J",
|
||||
expectedWindowWithGenesisPadding: []string{"I", "F", "H", "C", "D", "B", "G", "A", "A", "A"},
|
||||
expectedWindowWithGenesisPadding: []string{"I", "F", "C", "H", "D", "G", "B", "A", "A", "A"},
|
||||
},
|
||||
{
|
||||
parents: []string{"J"},
|
||||
id: "K",
|
||||
expectedWindowWithGenesisPadding: []string{"J", "I", "F", "H", "C", "D", "B", "G", "A", "A"},
|
||||
expectedWindowWithGenesisPadding: []string{"J", "I", "F", "C", "H", "D", "G", "B", "A", "A"},
|
||||
},
|
||||
{
|
||||
parents: []string{"K"},
|
||||
id: "L",
|
||||
expectedWindowWithGenesisPadding: []string{"K", "J", "I", "F", "H", "C", "D", "B", "G", "A"},
|
||||
expectedWindowWithGenesisPadding: []string{"K", "J", "I", "F", "C", "H", "D", "G", "B", "A"},
|
||||
},
|
||||
{
|
||||
parents: []string{"L"},
|
||||
id: "M",
|
||||
expectedWindowWithGenesisPadding: []string{"L", "K", "J", "I", "F", "H", "C", "D", "B", "G"},
|
||||
expectedWindowWithGenesisPadding: []string{"L", "K", "J", "I", "F", "C", "H", "D", "G", "B"},
|
||||
},
|
||||
{
|
||||
parents: []string{"M"},
|
||||
id: "N",
|
||||
expectedWindowWithGenesisPadding: []string{"M", "L", "K", "J", "I", "F", "H", "C", "D", "B"},
|
||||
expectedWindowWithGenesisPadding: []string{"M", "L", "K", "J", "I", "F", "C", "H", "D", "G"},
|
||||
},
|
||||
{
|
||||
parents: []string{"N"},
|
||||
id: "O",
|
||||
expectedWindowWithGenesisPadding: []string{"N", "M", "L", "K", "J", "I", "F", "H", "C", "D"},
|
||||
expectedWindowWithGenesisPadding: []string{"N", "M", "L", "K", "J", "I", "F", "C", "H", "D"},
|
||||
},
|
||||
},
|
||||
dagconfig.DevnetParams.Name: {
|
||||
|
||||
@@ -390,6 +390,9 @@ func (dt *DAGTopologyManagerImpl) IsAncestorOf(hashBlockA *externalapi.DomainHas
|
||||
func (dt *DAGTopologyManagerImpl) IsAncestorOfAny(blockHash *externalapi.DomainHash, potentialDescendants []*externalapi.DomainHash) (bool, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
func (dt *DAGTopologyManagerImpl) IsAnyAncestorOf([]*externalapi.DomainHash, *externalapi.DomainHash) (bool, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
func (dt *DAGTopologyManagerImpl) IsInSelectedParentChainOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
@@ -182,10 +182,10 @@ var testnetGenesisCoinbaseTx = transactionhelper.NewSubnetworkTransaction(0,
|
||||
// testnetGenesisHash is the hash of the first block in the block DAG for the test
|
||||
// network (genesis block).
|
||||
var testnetGenesisHash = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
|
||||
0x5d, 0xb7, 0x49, 0xc1, 0x6e, 0xfb, 0x4e, 0x7a,
|
||||
0x0c, 0x9f, 0xd1, 0x80, 0x74, 0x91, 0x60, 0xd0,
|
||||
0x1b, 0x84, 0xc7, 0x92, 0xa8, 0x5f, 0xcf, 0x9b,
|
||||
0x1d, 0x8c, 0x8c, 0x34, 0xa9, 0x41, 0x5f, 0xa5,
|
||||
0x49, 0xa6, 0x19, 0xe4, 0x25, 0xa0, 0x8d, 0xae,
|
||||
0xd9, 0x67, 0x76, 0x82, 0xd8, 0x8e, 0x93, 0xa3,
|
||||
0xf5, 0x42, 0x5a, 0x02, 0x4d, 0x55, 0xef, 0x5e,
|
||||
0x39, 0x61, 0x9f, 0x2d, 0xd9, 0x51, 0xe4, 0x55,
|
||||
})
|
||||
|
||||
// testnetGenesisMerkleRoot is the hash of the first transaction in the genesis block
|
||||
@@ -206,9 +206,9 @@ var testnetGenesisBlock = externalapi.DomainBlock{
|
||||
testnetGenesisMerkleRoot,
|
||||
&externalapi.DomainHash{},
|
||||
&externalapi.DomainHash{},
|
||||
0x176eb9ddb6d,
|
||||
0x177e83f864a,
|
||||
0x1e7fffff,
|
||||
0x5dba6,
|
||||
0x4d8e0,
|
||||
),
|
||||
Transactions: []*externalapi.DomainTransaction{testnetGenesisCoinbaseTx},
|
||||
}
|
||||
|
||||
@@ -256,11 +256,11 @@ var MainnetParams = Params{
|
||||
// TestnetParams defines the network parameters for the test Kaspa network.
|
||||
var TestnetParams = Params{
|
||||
K: defaultGHOSTDAGK,
|
||||
Name: "kaspa-testnet-2",
|
||||
Name: "kaspa-testnet-4",
|
||||
Net: appmessage.Testnet,
|
||||
RPCPort: "16210",
|
||||
DefaultPort: "16211",
|
||||
DNSSeeds: []string{"testnet-2-dnsseed.daglabs-dev.com"},
|
||||
DNSSeeds: []string{"testnet-4-dnsseed.daglabs-dev.com"},
|
||||
|
||||
// DAG parameters
|
||||
GenesisBlock: &testnetGenesisBlock,
|
||||
|
||||
@@ -35,13 +35,32 @@ func NewRouter() *Router {
|
||||
// be routed to the given `route`
|
||||
func (r *Router) AddIncomingRoute(messageTypes []appmessage.MessageCommand) (*Route, error) {
|
||||
route := NewRoute()
|
||||
err := r.initializeIncomingRoute(route, messageTypes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return route, nil
|
||||
}
|
||||
|
||||
// AddIncomingRouteWithCapacity registers the messages of types `messageTypes` to
|
||||
// be routed to the given `route` with a capacity of `capacity`
|
||||
func (r *Router) AddIncomingRouteWithCapacity(capacity int, messageTypes []appmessage.MessageCommand) (*Route, error) {
|
||||
route := newRouteWithCapacity(capacity)
|
||||
err := r.initializeIncomingRoute(route, messageTypes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return route, nil
|
||||
}
|
||||
|
||||
func (r *Router) initializeIncomingRoute(route *Route, messageTypes []appmessage.MessageCommand) error {
|
||||
for _, messageType := range messageTypes {
|
||||
if r.doesIncomingRouteExist(messageType) {
|
||||
return nil, errors.Errorf("a route for '%s' already exists", messageType)
|
||||
return errors.Errorf("a route for '%s' already exists", messageType)
|
||||
}
|
||||
r.setIncomingRoute(messageType, route)
|
||||
}
|
||||
return route, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveRoute unregisters the messages of types `messageTypes` from
|
||||
|
||||
@@ -85,6 +85,7 @@ func (x *GetBlocksResponseMessage) toAppMessage() (appmessage.Message, error) {
|
||||
}
|
||||
return &appmessage.GetBlocksResponseMessage{
|
||||
BlockVerboseData: blocksVerboseData,
|
||||
BlockHashes: x.BlockHashes,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const validCharacters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrs
|
||||
const (
|
||||
appMajor uint = 0
|
||||
appMinor uint = 9
|
||||
appPatch uint = 0
|
||||
appPatch uint = 2
|
||||
)
|
||||
|
||||
// appBuild is defined as a variable so it can be overridden during the build
|
||||
|
||||
Reference in New Issue
Block a user