name pre change

This commit is contained in:
c4ei 2023-08-23 15:04:37 +09:00
parent 8608748ac1
commit 54126889c5
8 changed files with 120 additions and 2 deletions

View File

@ -13,37 +13,51 @@ import (
const ( const (
// DefaultServices describes the default services that are supported by // DefaultServices describes the default services that are supported by
// the server. // the server.
// DefaultServices는 지원되는 기본 서비스를 설명합니다.
// 서버.
DefaultServices = SFNodeNetwork | SFNodeBloom | SFNodeCF DefaultServices = SFNodeNetwork | SFNodeBloom | SFNodeCF
) )
// ServiceFlag identifies services supported by a kaspa peer. // ServiceFlag identifies services supported by a kaspa peer.
// ServiceFlag는 kaspa 피어가 지원하는 서비스를 식별합니다.
type ServiceFlag uint64 type ServiceFlag uint64
const ( const (
// SFNodeNetwork is a flag used to indicate a peer is a full node. // SFNodeNetwork is a flag used to indicate a peer is a full node.
// ServiceFlag는 kaspa 액세서리가 지원하는 서비스를 정의합니다.
SFNodeNetwork ServiceFlag = 1 << iota SFNodeNetwork ServiceFlag = 1 << iota
// SFNodeGetUTXO is a flag used to indicate a peer supports the // SFNodeGetUTXO is a flag used to indicate a peer supports the
// getutxos and utxos commands (BIP0064). // getutxos and utxos commands (BIP0064).
// SFNodeGetUTXO는 피어가 다음을 지원함을 나타내는 데 사용되는 플래그입니다.
// getutxos 및 utxos 명령(BIP0064).
SFNodeGetUTXO SFNodeGetUTXO
// SFNodeBloom is a flag used to indicate a peer supports bloom // SFNodeBloom is a flag used to indicate a peer supports bloom
// filtering. // filtering.
// SFNodeBloom은 피어가 블룸을 지원함을 나타내는 데 사용되는 플래그입니다.
// 필터링 중입니다.
SFNodeBloom SFNodeBloom
// SFNodeXthin is a flag used to indicate a peer supports xthin blocks. // SFNodeXthin is a flag used to indicate a peer supports xthin blocks.
// SFNodeXthin은 피어가 xthin 블록을 지원함을 나타내는 데 사용되는 플래그입니다.
SFNodeXthin SFNodeXthin
// SFNodeBit5 is a flag used to indicate a peer supports a service // SFNodeBit5 is a flag used to indicate a peer supports a service
// defined by bit 5. // defined by bit 5.
// SFNodeBit5는 피어가 서비스를 지원함을 나타내는 데 사용되는 플래그입니다.
// 비트 5로 정의됩니다.
SFNodeBit5 SFNodeBit5
// SFNodeCF is a flag used to indicate a peer supports committed // SFNodeCF is a flag used to indicate a peer supports committed
// filters (CFs). // filters (CFs).
// SFNodeCF는 피어가 커밋을 지원함을 나타내는 데 사용되는 플래그입니다.
// 필터(CF).
SFNodeCF SFNodeCF
) )
// Map of service flags back to their constant names for pretty printing. // Map of service flags back to their constant names for pretty printing.
// 서비스 플래그 맵은 예쁜 인쇄를 위해 상수 이름으로 다시 표시됩니다.
var sfStrings = map[ServiceFlag]string{ var sfStrings = map[ServiceFlag]string{
SFNodeNetwork: "SFNodeNetwork", SFNodeNetwork: "SFNodeNetwork",
SFNodeGetUTXO: "SFNodeGetUTXO", SFNodeGetUTXO: "SFNodeGetUTXO",
@ -55,6 +69,8 @@ var sfStrings = map[ServiceFlag]string{
// orderedSFStrings is an ordered list of service flags from highest to // orderedSFStrings is an ordered list of service flags from highest to
// lowest. // lowest.
// OrderedSFStrings는 서비스 플래그를 가장 높은 것부터 순서대로 나열한 목록입니다.
// 최저.
var orderedSFStrings = []ServiceFlag{ var orderedSFStrings = []ServiceFlag{
SFNodeNetwork, SFNodeNetwork,
SFNodeGetUTXO, SFNodeGetUTXO,
@ -81,6 +97,7 @@ func (f ServiceFlag) String() string {
} }
// Add any remaining flags which aren't accounted for as hex. // Add any remaining flags which aren't accounted for as hex.
// 16진수로 간주되지 않는 나머지 플래그를 추가합니다.
s = strings.TrimRight(s, "|") s = strings.TrimRight(s, "|")
if f != 0 { if f != 0 {
s += "|0x" + strconv.FormatUint(uint64(f), 16) s += "|0x" + strconv.FormatUint(uint64(f), 16)
@ -90,14 +107,20 @@ func (f ServiceFlag) String() string {
} }
// KaspaNet represents which kaspa network a message belongs to. // KaspaNet represents which kaspa network a message belongs to.
// KaspaNet은 메시지가 속한 Kaspa 네트워크를 나타냅니다.
type KaspaNet uint32 type KaspaNet uint32
// Constants used to indicate the message kaspa network. They can also be // Constants used to indicate the message kaspa network. They can also be
// used to seek to the next message when a stream's state is unknown, but // used to seek to the next message when a stream's state is unknown, but
// this package does not provide that functionality since it's generally a // this package does not provide that functionality since it's generally a
// better idea to simply disconnect clients that are misbehaving over TCP. // better idea to simply disconnect clients that are misbehaving over TCP.
// 메시지 kaspa 네트워크를 나타내는 데 사용되는 상수입니다. 그들은 또한
// 스트림 상태를 알 수 없을 때 다음 메시지를 찾는 데 사용되지만,
// 이 패키지는 일반적으로 다음과 같은 기능을 제공하므로 해당 기능을 제공하지 않습니다.
// TCP를 통해 오작동하는 클라이언트의 연결을 끊는 것이 더 나은 아이디어입니다.
const ( const (
// Mainnet represents the main kaspa network. // Mainnet represents the main kaspa network.
// 메인넷은 주요 kaspa 네트워크를 나타냅니다.
Mainnet KaspaNet = 0x3ddcf71d Mainnet KaspaNet = 0x3ddcf71d
// Testnet represents the test network. // Testnet represents the test network.
@ -112,6 +135,8 @@ const (
// bnStrings is a map of kaspa networks back to their constant names for // bnStrings is a map of kaspa networks back to their constant names for
// pretty printing. // pretty printing.
// bnStrings는 kaspa 네트워크의 상수 이름으로 돌아가는 맵입니다.
// 예쁜 인쇄.
var bnStrings = map[KaspaNet]string{ var bnStrings = map[KaspaNet]string{
Mainnet: "Mainnet", Mainnet: "Mainnet",
Testnet: "Testnet", Testnet: "Testnet",
@ -120,6 +145,7 @@ var bnStrings = map[KaspaNet]string{
} }
// String returns the KaspaNet in human-readable form. // String returns the KaspaNet in human-readable form.
// 문자열은 사람이 읽을 수 있는 형식으로 KaspaNet을 반환합니다.
func (n KaspaNet) String() string { func (n KaspaNet) String() string {
if s, ok := bnStrings[n]; ok { if s, ok := bnStrings[n]; ok {
return s return s

View File

@ -268,6 +268,12 @@ Non-breaking changes:
* ExpectedHeaderPruningPoint fix (#1876) * ExpectedHeaderPruningPoint fix (#1876)
* Changes to libkaspawallet to support Kaspaper (#1878) * Changes to libkaspawallet to support Kaspaper (#1878)
* Get rid of genesis's UTXO dump (#1867) * Get rid of genesis's UTXO dump (#1867)
주요 변경 사항:
* devnet 및 testnet에서 헤더 질량을 무시합니다(#1879)
* CalcSubsidy에서 사용하지 않는 인수 제거(#1877)
* ExpectedHeaderPruningPoint 수정(#1876)
* Kaspaper를 지원하기 위해 libkaspwallet 변경(#1878)
* Genesis의 UTXO 덤프 제거(#1867)
Kaspad v0.11.2 - 2021-11-11 Kaspad v0.11.2 - 2021-11-11
=========================== ===========================

View File

@ -83,6 +83,7 @@ func (bpb *blockParentBuilder) BuildParents(stagingArea *model.StagingArea,
} }
if !foundFirstParentInFutureOfPruningPoint { if !foundFirstParentInFutureOfPruningPoint {
// BuildParents는 향후 가지치기 지점에서 적어도 하나의 부모를 얻어야 합니다.
return nil, errors.New("BuildParents should get at least one parent in the future of the pruning point") return nil, errors.New("BuildParents should get at least one parent in the future of the pruning point")
} }
@ -144,6 +145,8 @@ func (bpb *blockParentBuilder) BuildParents(stagingArea *model.StagingArea,
if hasReachabilityData { if hasReachabilityData {
// If a block is in the future of one of the virtual genesis children it means we have the full DAG between the current block // If a block is in the future of one of the virtual genesis children it means we have the full DAG between the current block
// and this parent, so there's no need for any indirect reference blocks, and normal reachability queries can be used. // and this parent, so there's no need for any indirect reference blocks, and normal reachability queries can be used.
// 블록이 가상 창세기 자식 중 하나의 미래에 있는 경우 이는 현재 블록 사이에 전체 DAG가 있음을 의미합니다.
// 및 이 부모이므로 간접 참조 블록이 필요하지 않으며 일반적인 연결 가능성 쿼리를 사용할 수 있습니다.
isInFutureOfVirtualGenesisChildren, err = bpb.dagTopologyManager.IsAnyAncestorOf(stagingArea, virtualGenesisChildren, parent) isInFutureOfVirtualGenesisChildren, err = bpb.dagTopologyManager.IsAnyAncestorOf(stagingArea, virtualGenesisChildren, parent)
if err != nil { if err != nil {
return nil, err return nil, err
@ -160,6 +163,16 @@ func (bpb *blockParentBuilder) BuildParents(stagingArea *model.StagingArea,
// the virtual genesis children in the pruning point anticone. So we can check which // the virtual genesis children in the pruning point anticone. So we can check which
// virtual genesis children have this block as parent and use those block as // virtual genesis children have this block as parent and use those block as
// reference blocks. // reference blocks.
// 참조 블록은 도달 가능성 쿼리에서 다음을 확인하는 데 사용되는 블록입니다.
// 후보자는 다른 후보자의 미래에 있습니다. 대부분의 경우 이는 단지
// 자체를 차단하지만 블록에 필요한 도달 가능성 데이터가 없는 경우
// 대신 미래에 일부 블록을 참조로 사용합니다.
// 먼저 가지치기 지점의 미래에 부모를 추가했는지 확인하면 다음을 수행할 수 있습니다.
// 가지치기에서 일부 블록의 과거에 있는 가지치기된 후보를 알고 있습니다.
// 포인트 안티콘은 다음 중 하나의 상위(관련 수준)여야 합니다.
// 가지치기 지점 안티콘의 가상 기원 자식. 그래서 우리는 어느 것을 확인할 수 있습니다
// 가상 제네시스 자식은 이 블록을 부모로 갖고 해당 블록을 다음과 같이 사용합니다.
// 참조 블록.
var referenceBlocks []*externalapi.DomainHash var referenceBlocks []*externalapi.DomainHash
if isInFutureOfVirtualGenesisChildren { if isInFutureOfVirtualGenesisChildren {
referenceBlocks = []*externalapi.DomainHash{parent} referenceBlocks = []*externalapi.DomainHash{parent}
@ -217,6 +230,8 @@ func (bpb *blockParentBuilder) BuildParents(stagingArea *model.StagingArea,
// We should add the block as a candidate if it's in the future of another candidate // We should add the block as a candidate if it's in the future of another candidate
// or in the anticone of all candidates. // or in the anticone of all candidates.
// 블록이 다른 후보의 미래에 있는 경우 해당 블록을 후보로 추가해야 합니다.
// 또는 모든 후보자의 반대쪽에 있습니다.
if !isAncestorOfAnyCandidate || toRemove.Length() > 0 { if !isAncestorOfAnyCandidate || toRemove.Length() > 0 {
candidatesByLevelToReferenceBlocksMap[blockLevel][*parent] = referenceBlocks candidatesByLevelToReferenceBlocksMap[blockLevel][*parent] = referenceBlocks
} }

View File

@ -4,6 +4,7 @@ import (
// we need to embed the utxoset of mainnet genesis here // we need to embed the utxoset of mainnet genesis here
_ "embed" _ "embed"
"fmt" "fmt"
"github.com/kaspanet/kaspad/domain/consensus/model" "github.com/kaspanet/kaspad/domain/consensus/model"
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi" "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
"github.com/kaspanet/kaspad/domain/consensus/ruleerrors" "github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
@ -233,6 +234,16 @@ func (bp *blockProcessor) loadUTXODataForGenesis(stagingArea *model.StagingArea,
// The actual UTXO set that fits Mainnet's genesis' UTXO commitment was removed from the codebase in order // The actual UTXO set that fits Mainnet's genesis' UTXO commitment was removed from the codebase in order
// to make reduce the consensus initialization time and the compiled binary size, but can be still // to make reduce the consensus initialization time and the compiled binary size, but can be still
// found here for anyone to verify: https://github.com/kaspanet/kaspad/blob/dbf18d8052f000ba0079be9e79b2d6f5a98b74ca/domain/consensus/processes/blockprocessor/resources/utxos.gz // found here for anyone to verify: https://github.com/kaspanet/kaspad/blob/dbf18d8052f000ba0079be9e79b2d6f5a98b74ca/domain/consensus/processes/blockprocessor/resources/utxos.gz
// 참고: 적용된 UTXO 집합 및 다중 집합은 UTXO 약속을 충족하지 않습니다.
// 메인넷의 탄생. 그렇기 때문에 모든 블록은 제네시스 위에 구축될 것입니다.
// 잘못된 UTXO 약속도 갖게 되며 합의에 도달할 수 없습니다.
// 나머지 네트워크와 함께.
// 이것이 바로 제네시스 위에 직접 블록을 가져오는 것이 금지된 이유이며, 유일한 방법은
// 최근 노드에 대한 증명을 요청하여 생성된 노드의 최신 상태를 얻습니다.
// 가지치기 지점.
// 메인넷 제네시스의 UTXO 공약에 맞는 실제 UTXO 세트는 순서대로 코드베이스에서 제거되었습니다.
// 합의 초기화 시간과 컴파일된 바이너리 크기를 줄이기 위해 하지만 여전히
// 누구나 확인할 수 있도록 여기에 있습니다: https://github.com/kaspanet/kaspad/blob/dbf18d8052f000ba0079be9e79b2d6f5a98b74ca/domain/consensus/processes/blockprocessor/resources/utxos.gz
bp.consensusStateStore.StageVirtualUTXODiff(stagingArea, utxo.NewUTXODiff()) bp.consensusStateStore.StageVirtualUTXODiff(stagingArea, utxo.NewUTXODiff())
bp.utxoDiffStore.Stage(stagingArea, blockHash, utxo.NewUTXODiff(), nil) bp.utxoDiffStore.Stage(stagingArea, blockHash, utxo.NewUTXODiff(), nil)
bp.multisetStore.Stage(stagingArea, blockHash, multiset.New()) bp.multisetStore.Stage(stagingArea, blockHash, multiset.New())

View File

@ -9,7 +9,7 @@ import (
func (bp *blockProcessor) validateAndInsertImportedPruningPoint( func (bp *blockProcessor) validateAndInsertImportedPruningPoint(
stagingArea *model.StagingArea, newPruningPointHash *externalapi.DomainHash) error { stagingArea *model.StagingArea, newPruningPointHash *externalapi.DomainHash) error {
// 주어진 가지치기 지점이 예상되는 가지치기 지점인지 확인
log.Info("Checking that the given pruning point is the expected pruning point") log.Info("Checking that the given pruning point is the expected pruning point")
isValidPruningPoint, err := bp.pruningManager.IsValidPruningPoint(stagingArea, newPruningPointHash) isValidPruningPoint, err := bp.pruningManager.IsValidPruningPoint(stagingArea, newPruningPointHash)
@ -18,6 +18,7 @@ func (bp *blockProcessor) validateAndInsertImportedPruningPoint(
} }
if !isValidPruningPoint { if !isValidPruningPoint {
// 유효한 가지치기 지점이 아닙니다.
return errors.Wrapf(ruleerrors.ErrUnexpectedPruningPoint, "%s is not a valid pruning point", return errors.Wrapf(ruleerrors.ErrUnexpectedPruningPoint, "%s is not a valid pruning point",
newPruningPointHash) newPruningPointHash)
} }
@ -28,10 +29,11 @@ func (bp *blockProcessor) validateAndInsertImportedPruningPoint(
} }
if !arePruningPointsInValidChain { if !arePruningPointsInValidChain {
// 가지치기 지점은 유효한 "+"제네시스 체인
return errors.Wrapf(ruleerrors.ErrInvalidPruningPointsChain, "pruning points do not compose a valid "+ return errors.Wrapf(ruleerrors.ErrInvalidPruningPointsChain, "pruning points do not compose a valid "+
"chain to genesis") "chain to genesis")
} }
// 새로운 가지치기 지점에 따라 합의 상태 관리자 업데이트
log.Infof("Updating consensus state manager according to the new pruning point %s", newPruningPointHash) log.Infof("Updating consensus state manager according to the new pruning point %s", newPruningPointHash)
err = bp.consensusStateManager.ImportPruningPointUTXOSet(stagingArea, newPruningPointHash) err = bp.consensusStateManager.ImportPruningPointUTXOSet(stagingArea, newPruningPointHash)
if err != nil { if err != nil {

View File

@ -83,6 +83,7 @@ func (csm *consensusStateManager) isCandidateToBeNextVirtualSelectedParent(
defer log.Tracef("isCandidateToBeNextVirtualSelectedParent end for block %s", blockHash) defer log.Tracef("isCandidateToBeNextVirtualSelectedParent end for block %s", blockHash)
if blockHash.Equal(csm.genesisHash) { if blockHash.Equal(csm.genesisHash) {
// "블록 %s은(는) 최초 블록이므로 "+"정의에 따라 선택된 부모"
log.Debugf("Block %s is the genesis block, therefore it is "+ log.Debugf("Block %s is the genesis block, therefore it is "+
"the selected parent by definition", blockHash) "the selected parent by definition", blockHash)
return true, nil return true, nil
@ -128,6 +129,7 @@ func (csm *consensusStateManager) calculateNewTips(
defer log.Tracef("calculateNewTips end for new tip %s", newTipHash) defer log.Tracef("calculateNewTips end for new tip %s", newTipHash)
if newTipHash.Equal(csm.genesisHash) { if newTipHash.Equal(csm.genesisHash) {
// 새로운 팁은 제네시스 블록이므로 정의상 유일한 팁입니다.
log.Debugf("The new tip is the genesis block, therefore it is the only tip by definition") log.Debugf("The new tip is the genesis block, therefore it is the only tip by definition")
return []*externalapi.DomainHash{newTipHash}, nil return []*externalapi.DomainHash{newTipHash}, nil
} }

View File

@ -49,6 +49,9 @@ type KType uint8
// Params defines a Kaspa network by its parameters. These parameters may be // Params defines a Kaspa network by its parameters. These parameters may be
// used by Kaspa applications to differentiate networks as well as addresses // used by Kaspa applications to differentiate networks as well as addresses
// and keys for one network from those intended for use on another network. // and keys for one network from those intended for use on another network.
// Params는 매개변수로 Kaspa 네트워크를 정의합니다. 이러한 매개변수는 다음과 같습니다.
// 네트워크와 주소를 구별하기 위해 Kaspa 애플리케이션에서 사용됩니다.
// 그리고 다른 네트워크에서 사용하기 위한 키 중 하나의 네트워크에 대한 키입니다.
type Params struct { type Params struct {
// K defines the K parameter for GHOSTDAG consensus algorithm. // K defines the K parameter for GHOSTDAG consensus algorithm.
// See ghostdag.go for further details. // See ghostdag.go for further details.
@ -86,11 +89,16 @@ type Params struct {
// BlockCoinbaseMaturity is the number of blocks required before newly mined // BlockCoinbaseMaturity is the number of blocks required before newly mined
// coins can be spent. // coins can be spent.
// BlockCoinbaseMaturity는 새로 채굴되기 전에 필요한 블록 수입니다.
// 코인을 사용할 수 있습니다.
BlockCoinbaseMaturity uint64 BlockCoinbaseMaturity uint64
// SubsidyGenesisReward SubsidyMergeSetRewardMultiplier, and // SubsidyGenesisReward SubsidyMergeSetRewardMultiplier, and
// SubsidyPastRewardMultiplier are part of the block subsidy equation. // SubsidyPastRewardMultiplier are part of the block subsidy equation.
// Further details: https://hashdag.medium.com/kaspa-launch-plan-9a63f4d754a6 // Further details: https://hashdag.medium.com/kaspa-launch-plan-9a63f4d754a6
// SubsidyGenesisReward SubsidyMergeSetRewardMultiplier 및
// SubsidyPastRewardMultiplier는 블록 보조금 방정식의 일부입니다.
// 자세한 내용: https://hashdag.medium.com/kaspa-launch-plan-9a63f4d754a6
SubsidyGenesisReward uint64 SubsidyGenesisReward uint64
PreDeflationaryPhaseBaseSubsidy uint64 PreDeflationaryPhaseBaseSubsidy uint64
DeflationaryPhaseBaseSubsidy uint64 DeflationaryPhaseBaseSubsidy uint64
@ -104,10 +112,14 @@ type Params struct {
// TimestampDeviationTolerance is the maximum offset a block timestamp // TimestampDeviationTolerance is the maximum offset a block timestamp
// is allowed to be in the future before it gets delayed // is allowed to be in the future before it gets delayed
// TimestampDeviationTolerance는 블록 타임스탬프의 최대 오프셋입니다.
// 지연되기 전에 미래에 있을 수 있습니다.
TimestampDeviationTolerance int TimestampDeviationTolerance int
// DifficultyAdjustmentWindowSize is the size of window that is inspected // DifficultyAdjustmentWindowSize is the size of window that is inspected
// to calculate the required difficulty of each block. // to calculate the required difficulty of each block.
// TimestampDeviationTolerance는 블록 타임스탬프의 최대 예외입니다.
// 지연되기 전에 미래에 있을 수 있습니다.
DifficultyAdjustmentWindowSize int DifficultyAdjustmentWindowSize int
// These fields are related to voting on consensus rule changes as // These fields are related to voting on consensus rule changes as
@ -123,6 +135,16 @@ type Params struct {
// //
// Deployments define the specific consensus rule changes to be voted // Deployments define the specific consensus rule changes to be voted
// on. // on.
// 이 필드는 다음과 같이 합의 규칙 변경에 대한 투표와 관련됩니다.
// BIP0009에 의해 정의됩니다.
// RuleChangeActivationThreshold는 임계값의 블록 수입니다.
// 규칙 변경에 대해 긍정적인 투표를 한 상태 재타겟 창 상태
// 규칙 변경을 잠그려면 캐스팅해야 합니다. 일반적으로
// 메인 네트워크의 경우 95%, 테스트 네트워크의 경우 75%입니다.
// MinerConfirmationWindow는 각 임계값의 블록 수입니다.
// 상태 변경 창.
// 배포는 투표할 특정 합의 규칙 변경 사항을 정의합니다.
// 에.
RuleChangeActivationThreshold uint64 RuleChangeActivationThreshold uint64
MinerConfirmationWindow uint64 MinerConfirmationWindow uint64
@ -131,60 +153,81 @@ type Params struct {
// AcceptUnroutable specifies whether this network accepts unroutable // AcceptUnroutable specifies whether this network accepts unroutable
// IP addresses, such as 10.0.0.0/8 // IP addresses, such as 10.0.0.0/8
// AcceptUnroutable은 이 네트워크가 라우팅 불가를 허용하는지 여부를 지정합니다.
// IP 주소(예: 10.0.0.0/8)
AcceptUnroutable bool AcceptUnroutable bool
// Human-readable prefix for Bech32 encoded addresses // Human-readable prefix for Bech32 encoded addresses
// Bech32로 인코딩된 주소에 대한 사람이 읽을 수 있는 접두사
Prefix util.Bech32Prefix Prefix util.Bech32Prefix
// Address encoding magics // Address encoding magics
PrivateKeyID byte // First byte of a WIF private key PrivateKeyID byte // First byte of a WIF private key
// EnableNonNativeSubnetworks enables non-native/coinbase transactions // EnableNonNativeSubnetworks enables non-native/coinbase transactions
// EnableNonNativeSubnetworks는 비네이티브/코인베이스 거래를 활성화합니다.
EnableNonNativeSubnetworks bool EnableNonNativeSubnetworks bool
// DisableDifficultyAdjustment determine whether to use difficulty // DisableDifficultyAdjustment determine whether to use difficulty
// DisableDifficultyAdjustment 난이도 사용 여부를 결정합니다.
DisableDifficultyAdjustment bool DisableDifficultyAdjustment bool
// SkipProofOfWork indicates whether proof of work should be checked. // SkipProofOfWork indicates whether proof of work should be checked.
// SkipProofOfWork는 작업 증명을 확인해야 하는지 여부를 나타냅니다.
SkipProofOfWork bool SkipProofOfWork bool
// MaxCoinbasePayloadLength is the maximum length in bytes allowed for a block's coinbase's payload // MaxCoinbasePayloadLength is the maximum length in bytes allowed for a block's coinbase's payload
// MaxCoinbasePayloadLength는 블록의 코인베이스 페이로드에 허용되는 최대 길이(바이트)입니다.
MaxCoinbasePayloadLength uint64 MaxCoinbasePayloadLength uint64
// MaxBlockMass is the maximum mass a block is allowed // MaxBlockMass is the maximum mass a block is allowed
// MaxBlockMass는 블록에 허용되는 최대 질량입니다.
MaxBlockMass uint64 MaxBlockMass uint64
// MaxBlockParents is the maximum number of blocks a block is allowed to point to // MaxBlockParents is the maximum number of blocks a block is allowed to point to
// MaxBlockParents는 블록이 가리킬 수 있는 최대 블록 수입니다.
MaxBlockParents externalapi.KType MaxBlockParents externalapi.KType
// MassPerTxByte is the number of grams that any byte // MassPerTxByte is the number of grams that any byte
// adds to a transaction. // adds to a transaction.
// MassPerTxByte는 임의의 바이트가 전송하는 그램 수입니다.
// 트랜잭션에 추가합니다.
MassPerTxByte uint64 MassPerTxByte uint64
// MassPerScriptPubKeyByte is the number of grams that any // MassPerScriptPubKeyByte is the number of grams that any
// scriptPubKey byte adds to a transaction. // scriptPubKey byte adds to a transaction.
// MassPerScriptPubKeyByte는 임의의 그램 수입니다.
// scriptPubKey 바이트가 트랜잭션에 추가됩니다.
MassPerScriptPubKeyByte uint64 MassPerScriptPubKeyByte uint64
// MassPerSigOp is the number of grams that any // MassPerSigOp is the number of grams that any
// signature operation adds to a transaction. // signature operation adds to a transaction.
// MassPerSigOp는 임의의 그램 수입니다.
// 서명 작업이 트랜잭션에 추가됩니다.
MassPerSigOp uint64 MassPerSigOp uint64
// MergeSetSizeLimit is the maximum number of blocks in a block's merge set // MergeSetSizeLimit is the maximum number of blocks in a block's merge set
// MergeSetSizeLimit은 블록 병합 세트의 최대 블록 수입니다.
MergeSetSizeLimit uint64 MergeSetSizeLimit uint64
// CoinbasePayloadScriptPublicKeyMaxLength is the maximum allowed script public key in the coinbase's payload // CoinbasePayloadScriptPublicKeyMaxLength is the maximum allowed script public key in the coinbase's payload
// CoinbasePayloadScriptPublicKeyMaxLength는 코인베이스 페이로드에서 허용되는 최대 스크립트 공개 키입니다.
CoinbasePayloadScriptPublicKeyMaxLength uint8 CoinbasePayloadScriptPublicKeyMaxLength uint8
// PruningProofM is the 'm' constant in the pruning proof. For more details see: https://github.com/kaspanet/research/issues/3 // PruningProofM is the 'm' constant in the pruning proof. For more details see: https://github.com/kaspanet/research/issues/3
// PruningProofM은 가지치기 증명의 'm' 상수입니다. 자세한 내용은 https://github.com/kaspanet/research/issues/3을 참조하세요.
PruningProofM uint64 PruningProofM uint64
// DeflationaryPhaseDaaScore is the DAA score after which the monetary policy switches // DeflationaryPhaseDaaScore is the DAA score after which the monetary policy switches
// to its deflationary phase // to its deflationary phase
// DeflationaryPhaseDaaScore는 통화 정책이 전환된 이후의 DAA 점수입니다.
// 디플레이션 단계로
DeflationaryPhaseDaaScore uint64 DeflationaryPhaseDaaScore uint64
DisallowDirectBlocksOnTopOfGenesis bool DisallowDirectBlocksOnTopOfGenesis bool
// MaxBlockLevel is the maximum possible block level. // MaxBlockLevel is the maximum possible block level.
// MaxBlockLevel은 가능한 최대 블록 레벨입니다.
MaxBlockLevel int MaxBlockLevel int
MergeDepth uint64 MergeDepth uint64
@ -192,21 +235,26 @@ type Params struct {
// NormalizeRPCServerAddress returns addr with the current network default // NormalizeRPCServerAddress returns addr with the current network default
// port appended if there is not already a port specified. // port appended if there is not already a port specified.
// NormalizeRPCServerAddress는 현재 네트워크 기본값으로 addr을 반환합니다.
// 포트가 아직 지정되지 않은 경우 포트가 추가됩니다.
func (p *Params) NormalizeRPCServerAddress(addr string) (string, error) { func (p *Params) NormalizeRPCServerAddress(addr string) (string, error) {
return network.NormalizeAddress(addr, p.RPCPort) return network.NormalizeAddress(addr, p.RPCPort)
} }
// FinalityDepth returns the finality duration represented in blocks // FinalityDepth returns the finality duration represented in blocks
// FinalityDepth는 블록으로 표현된 최종 지속 기간을 반환합니다.
func (p *Params) FinalityDepth() uint64 { func (p *Params) FinalityDepth() uint64 {
return uint64(p.FinalityDuration / p.TargetTimePerBlock) return uint64(p.FinalityDuration / p.TargetTimePerBlock)
} }
// PruningDepth returns the pruning duration represented in blocks // PruningDepth returns the pruning duration represented in blocks
// PruningDepth는 블록으로 표시된 가지치기 기간을 반환합니다.
func (p *Params) PruningDepth() uint64 { func (p *Params) PruningDepth() uint64 {
return 2*p.FinalityDepth() + 4*p.MergeSetSizeLimit*uint64(p.K) + 2*uint64(p.K) + 2 return 2*p.FinalityDepth() + 4*p.MergeSetSizeLimit*uint64(p.K) + 2*uint64(p.K) + 2
} }
// MainnetParams defines the network parameters for the main Kaspa network. // MainnetParams defines the network parameters for the main Kaspa network.
// MainnetParams는 기본 Kaspa 네트워크에 대한 네트워크 매개변수를 정의합니다.
var MainnetParams = Params{ var MainnetParams = Params{
K: defaultGHOSTDAGK, K: defaultGHOSTDAGK,
Name: "c4ex-mainnet", Name: "c4ex-mainnet",
@ -365,6 +413,13 @@ var TestnetParams = Params{
// which are specifically specified are used to create the network rather than // which are specifically specified are used to create the network rather than
// following normal discovery rules. This is important as otherwise it would // following normal discovery rules. This is important as otherwise it would
// just turn into another public testnet. // just turn into another public testnet.
// SimnetParams는 Kaspa 시뮬레이션 테스트를 위한 네트워크 매개변수를 정의합니다.
// 네트워크. 이 네트워크는 다음을 제외하면 일반 테스트 네트워크와 유사합니다.
// 시뮬레이션을 수행하는 개인 그룹 내에서 개인적으로 사용하기 위한 것입니다.
// 테스트 중입니다. 기능은 유일한 노드라는 점에서 다릅니다.
// 특별히 지정된 것은 네트워크를 생성하는 데 사용됩니다.
// 일반적인 검색 규칙을 따릅니다. 그렇지 않은 경우에는 이것이 중요합니다.
// 다른 공개 테스트넷으로 전환합니다.
var SimnetParams = Params{ var SimnetParams = Params{
K: defaultGHOSTDAGK, K: defaultGHOSTDAGK,
Name: "c4ex-simnet", Name: "c4ex-simnet",

View File

@ -153,6 +153,7 @@ func mineOrFetchBlock(blockData JSONBlock, mdb *miningDB, testConsensus testapi.
var random = rand.New(rand.NewSource(time.Now().UnixNano())) var random = rand.New(rand.NewSource(time.Now().UnixNano()))
// SolveBlock increments the given block's nonce until it matches the difficulty requirements in its bits field // SolveBlock increments the given block's nonce until it matches the difficulty requirements in its bits field
// SolveBlock은 비트 필드의 난이도 요구 사항과 일치할 때까지 주어진 블록의 nonce를 증가시킵니다.
func SolveBlock(block *externalapi.DomainBlock) { func SolveBlock(block *externalapi.DomainBlock) {
mining.SolveBlock(block, random) mining.SolveBlock(block, random)
} }