Skip to content

Commit

Permalink
rename max parents
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberphysic4l committed Nov 2, 2023
1 parent a6d98f3 commit 20b8d01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions block.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
const (
// MaxBlockSize defines the maximum size of a block.
MaxBlockSize = 32768
// BlockMaxParents defines the maximum amount of parents in a block.
BlockMaxParents = 8
// BlockTypeValidationMaxParents defines the maximum amount of parents in a ValidationBlock. TODO: replace number with committee size.
BlockTypeValidationMaxParents = BlockMaxParents + 42
// BasicBlockMaxParents defines the maximum number of parents in a basic block.
BasicBlockMaxParents = 8
// ValidationBlockMaxParents defines the maximum number of parents in a ValidationBlock.
ValidationBlockMaxParents = 50

// block type + strong parents count + weak parents count + shallow like parents count + payload type + mana.
BasicBlockSizeEmptyParentsAndEmptyPayload = serializer.OneByte + serializer.OneByte + serializer.OneByte + serializer.OneByte + serializer.TypeDenotationByteSize + ManaSize
Expand Down
4 changes: 2 additions & 2 deletions tpkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ func RandBasicBlock(api iotago.API, withPayloadType iotago.PayloadType) *iotago.

return &iotago.BasicBlockBody{
API: api,
StrongParents: SortedRandBlockIDs(1 + rand.Intn(iotago.BlockMaxParents)),
StrongParents: SortedRandBlockIDs(1 + rand.Intn(iotago.BasicBlockMaxParents)),
WeakParents: iotago.BlockIDs{},
ShallowLikeParents: iotago.BlockIDs{},
Payload: payload,
Expand All @@ -760,7 +760,7 @@ func RandBasicBlock(api iotago.API, withPayloadType iotago.PayloadType) *iotago.
func RandValidationBlock(api iotago.API) *iotago.ValidationBlockBody {
return &iotago.ValidationBlockBody{
API: api,
StrongParents: SortedRandBlockIDs(1 + rand.Intn(iotago.BlockTypeValidationMaxParents)),
StrongParents: SortedRandBlockIDs(1 + rand.Intn(iotago.ValidationBlockMaxParents)),
WeakParents: iotago.BlockIDs{},
ShallowLikeParents: iotago.BlockIDs{},
HighestSupportedVersion: TestAPI.Version() + 1,
Expand Down

0 comments on commit 20b8d01

Please sign in to comment.