Skip to content

Commit

Permalink
Renamed RandSlotIndex to RandSlot and added RandEpoch
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsporn committed Oct 10, 2023
1 parent 8856cf2 commit 3d51abf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nodeclient/http_api_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ func nodeClient(t *testing.T) *nodeclient.Client {
Version: "1.0.0",
Status: &apimodels.InfoResNodeStatus{
IsHealthy: true,
LatestAcceptedBlockSlot: tpkg.RandSlotIndex(),
LatestConfirmedBlockSlot: tpkg.RandSlotIndex(),
LatestAcceptedBlockSlot: tpkg.RandSlot(),
LatestConfirmedBlockSlot: tpkg.RandSlot(),
LatestFinalizedSlot: iotago.SlotIndex(142857),
AcceptedTangleTime: ts,
RelativeAcceptedTangleTime: ts,
Expand Down
12 changes: 8 additions & 4 deletions tpkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ func RandTransactionIDWithCreationSlot(slot iotago.SlotIndex) iotago.Transaction
}

func RandSignedTransactionID() iotago.SignedTransactionID {
return RandSignedTransactionIDWithCreationSlot(RandSlotIndex())
return RandSignedTransactionIDWithCreationSlot(RandSlot())
}

func RandTransactionID() iotago.TransactionID {
return RandTransactionIDWithCreationSlot(RandSlotIndex())
return RandTransactionIDWithCreationSlot(RandSlot())
}

func RandNativeTokenID() iotago.NativeTokenID {
Expand Down Expand Up @@ -656,10 +656,14 @@ func RandDelegationID() iotago.DelegationID {
return delegation
}

func RandSlotIndex() iotago.SlotIndex {
func RandSlot() iotago.SlotIndex {
return iotago.SlotIndex(RandUint32(uint32(iotago.MaxSlotIndex)))
}

func RandEpoch() iotago.EpochIndex {
return iotago.EpochIndex(RandUint32(uint32(iotago.MaxEpochIndex)))
}

func RandDuration() time.Duration {
return time.Duration(RandInt64(math.MaxInt64))
}
Expand Down Expand Up @@ -1027,7 +1031,7 @@ func RandProtocolParameters() iotago.ProtocolParameters {
RandWorkScore(math.MaxUint32),
),
iotago.WithTimeProviderOptions(time.Now().Unix(), RandUint8(math.MaxUint8), RandUint8(math.MaxUint8)),
iotago.WithLivenessOptions(RandUint16(math.MaxUint16), RandUint16(math.MaxUint16), RandSlotIndex(), RandSlotIndex(), RandSlotIndex()),
iotago.WithLivenessOptions(RandUint16(math.MaxUint16), RandUint16(math.MaxUint16), RandSlot(), RandSlot(), RandSlot()),
iotago.WithCongestionControlOptions(
RandMana(iotago.MaxMana),
RandMana(iotago.MaxMana),
Expand Down

0 comments on commit 3d51abf

Please sign in to comment.