Documentation ¶
Index ¶
- Variables
- type Message
- type MessageBuilder
- func (b *MessageBuilder) Amount(amount uint64) *MessageBuilder
- func (b *MessageBuilder) Build() *Message
- func (b *MessageBuilder) BuildIndexation() *Message
- func (b *MessageBuilder) DustAllowance() *MessageBuilder
- func (b *MessageBuilder) FakeInputs() *MessageBuilder
- func (b *MessageBuilder) FromWallet(wallet *utils.HDWallet) *MessageBuilder
- func (b *MessageBuilder) Parents(parents hornet.MessageIDs) *MessageBuilder
- func (b *MessageBuilder) ToWallet(wallet *utils.HDWallet) *MessageBuilder
- func (b *MessageBuilder) UsingOutput(output *utxo.Output) *MessageBuilder
- type TestEnvironment
- func (te *TestEnvironment) AssertMessageConflictReason(messageID hornet.MessageID, conflict storage.Conflict)
- func (te *TestEnvironment) AssertTotalSupplyStillValid()
- func (te *TestEnvironment) AssertWalletBalance(wallet *utils.HDWallet, expectedBalance uint64)
- func (te *TestEnvironment) BuildTangle(initMessagesCount int, belowMaxDepth int, milestonesCount int, ...) (messages hornet.MessageIDs, messagesPerMilestones []hornet.MessageIDs)
- func (te *TestEnvironment) CleanupTestEnvironment(removeTempDir bool)
- func (te *TestEnvironment) IssueAndConfirmMilestoneOnTips(tips hornet.MessageIDs, createConfirmationGraph bool) (*whiteflag.Confirmation, *whiteflag.ConfirmedMilestoneStats)
- func (te *TestEnvironment) NewMessageBuilder(indexation string) *MessageBuilder
- func (te *TestEnvironment) NewTestMessage(index int, parents hornet.MessageIDs) *storage.MessageMetadata
- func (te *TestEnvironment) Storage() *storage.Storage
- func (te *TestEnvironment) StoreMessage(msg *storage.Message) *storage.CachedMessage
- func (te *TestEnvironment) UTXO() *utxo.Manager
- func (te *TestEnvironment) VerifyCMI(index milestone.Index)
- func (te *TestEnvironment) VerifyLMI(index milestone.Index)
Constants ¶
This section is empty.
Variables ¶
var TestProfileCaches = &profile.Caches{ Addresses: &profile.CacheOpts{ CacheTime: "200ms", ReleaseExecutorWorkerCount: 10, LeakDetectionOptions: &profile.LeakDetectionOpts{ Enabled: false, MaxConsumersPerObject: 20, MaxConsumerHoldTime: "100s", }, }, Children: &profile.CacheOpts{ CacheTime: "5s", ReleaseExecutorWorkerCount: 10, LeakDetectionOptions: &profile.LeakDetectionOpts{ Enabled: false, MaxConsumersPerObject: 20, MaxConsumerHoldTime: "100s", }, }, Indexations: &profile.CacheOpts{ CacheTime: "200ms", ReleaseExecutorWorkerCount: 10, LeakDetectionOptions: &profile.LeakDetectionOpts{ Enabled: false, MaxConsumersPerObject: 20, MaxConsumerHoldTime: "100s", }, }, Milestones: &profile.CacheOpts{ CacheTime: "2.5s", ReleaseExecutorWorkerCount: 10, LeakDetectionOptions: &profile.LeakDetectionOpts{ Enabled: false, MaxConsumersPerObject: 20, MaxConsumerHoldTime: "100s", }, }, Messages: &profile.CacheOpts{ CacheTime: "5s", ReleaseExecutorWorkerCount: 10, LeakDetectionOptions: &profile.LeakDetectionOpts{ Enabled: false, MaxConsumersPerObject: 20, MaxConsumerHoldTime: "100s", }, }, UnreferencedMessages: &profile.CacheOpts{ CacheTime: "100ms", ReleaseExecutorWorkerCount: 10, LeakDetectionOptions: &profile.LeakDetectionOpts{ Enabled: false, MaxConsumersPerObject: 20, MaxConsumerHoldTime: "100s", }, }, IncomingMessagesFilter: &profile.CacheOpts{ CacheTime: "2.5s", ReleaseExecutorWorkerCount: 10, LeakDetectionOptions: &profile.LeakDetectionOpts{ Enabled: false, MaxConsumersPerObject: 20, MaxConsumerHoldTime: "100s", }, }, }
Functions ¶
This section is empty.
Types ¶
type Message ¶ added in v1.0.0
type Message struct {
// contains filtered or unexported fields
}
func (*Message) BookOnWallets ¶ added in v1.0.0
func (*Message) GeneratedUTXO ¶ added in v1.0.0
func (*Message) StoredMessageID ¶ added in v1.0.0
type MessageBuilder ¶ added in v1.0.0
type MessageBuilder struct {
// contains filtered or unexported fields
}
func (*MessageBuilder) Amount ¶ added in v1.0.0
func (b *MessageBuilder) Amount(amount uint64) *MessageBuilder
func (*MessageBuilder) Build ¶ added in v1.0.0
func (b *MessageBuilder) Build() *Message
func (*MessageBuilder) BuildIndexation ¶ added in v1.0.0
func (b *MessageBuilder) BuildIndexation() *Message
func (*MessageBuilder) DustAllowance ¶ added in v1.0.0
func (b *MessageBuilder) DustAllowance() *MessageBuilder
func (*MessageBuilder) FakeInputs ¶ added in v1.0.0
func (b *MessageBuilder) FakeInputs() *MessageBuilder
func (*MessageBuilder) FromWallet ¶ added in v1.0.0
func (b *MessageBuilder) FromWallet(wallet *utils.HDWallet) *MessageBuilder
func (*MessageBuilder) Parents ¶ added in v1.0.0
func (b *MessageBuilder) Parents(parents hornet.MessageIDs) *MessageBuilder
func (*MessageBuilder) ToWallet ¶ added in v1.0.0
func (b *MessageBuilder) ToWallet(wallet *utils.HDWallet) *MessageBuilder
func (*MessageBuilder) UsingOutput ¶ added in v1.0.0
func (b *MessageBuilder) UsingOutput(output *utxo.Output) *MessageBuilder
type TestEnvironment ¶
type TestEnvironment struct { // TestInterface is the common interface for tests and benchmarks. TestInterface testing.TB // Milestones are the created milestones by the coordinator during the test. Milestones storage.CachedMilestones // PoWHandler holds the PoWHandler instance. PoWHandler *pow.Handler // GenesisOutput marks the initial output created when bootstrapping the tangle GenesisOutput *utxo.Output // contains filtered or unexported fields }
TestEnvironment holds the state of the test environment.
func SetupTestEnvironment ¶
func SetupTestEnvironment(testInterface testing.TB, genesisAddress *iotago.Ed25519Address, numberOfMilestones int, belowMaxDepth int, targetScore float64, showConfirmationGraphs bool) *TestEnvironment
SetupTestEnvironment initializes a clean database with initial snapshot, configures a coordinator with a clean state, bootstraps the network and issues the first "numberOfMilestones" milestones.
func (*TestEnvironment) AssertMessageConflictReason ¶ added in v1.0.0
func (te *TestEnvironment) AssertMessageConflictReason(messageID hornet.MessageID, conflict storage.Conflict)
func (*TestEnvironment) AssertTotalSupplyStillValid ¶
func (te *TestEnvironment) AssertTotalSupplyStillValid()
AssertTotalSupplyStillValid checks if the total supply in the database is still correct.
func (*TestEnvironment) AssertWalletBalance ¶ added in v1.0.0
func (te *TestEnvironment) AssertWalletBalance(wallet *utils.HDWallet, expectedBalance uint64)
AssertWalletBalance generates an address for the given seed and index and checks correct balance.
func (*TestEnvironment) BuildTangle ¶ added in v1.0.0
func (te *TestEnvironment) BuildTangle(initMessagesCount int, belowMaxDepth int, milestonesCount int, minMessagesPerMilestone int, maxMessagesPerMilestone int, onNewMessage func(cmi milestone.Index, msgMeta *storage.MessageMetadata), milestoneTipSelectFunc func(messages hornet.MessageIDs, messagesPerMilestones []hornet.MessageIDs) hornet.MessageIDs, onNewMilestone func(msIndex milestone.Index, messages hornet.MessageIDs, conf *whiteflag.Confirmation, confStats *whiteflag.ConfirmedMilestoneStats)) (messages hornet.MessageIDs, messagesPerMilestones []hornet.MessageIDs)
BuildTangle builds a tangle structure without a tipselection algorithm, but random tips from the last messages in the last belowMaxDepth milestones.
func (*TestEnvironment) CleanupTestEnvironment ¶
func (te *TestEnvironment) CleanupTestEnvironment(removeTempDir bool)
CleanupTestEnvironment cleans up everything at the end of the test.
func (*TestEnvironment) IssueAndConfirmMilestoneOnTips ¶ added in v1.0.0
func (te *TestEnvironment) IssueAndConfirmMilestoneOnTips(tips hornet.MessageIDs, createConfirmationGraph bool) (*whiteflag.Confirmation, *whiteflag.ConfirmedMilestoneStats)
IssueAndConfirmMilestoneOnTips creates a milestone on top of the given tips.
func (*TestEnvironment) NewMessageBuilder ¶ added in v1.0.0
func (te *TestEnvironment) NewMessageBuilder(indexation string) *MessageBuilder
func (*TestEnvironment) NewTestMessage ¶ added in v1.0.0
func (te *TestEnvironment) NewTestMessage(index int, parents hornet.MessageIDs) *storage.MessageMetadata
func (*TestEnvironment) Storage ¶ added in v1.0.0
func (te *TestEnvironment) Storage() *storage.Storage
func (*TestEnvironment) StoreMessage ¶ added in v1.0.0
func (te *TestEnvironment) StoreMessage(msg *storage.Message) *storage.CachedMessage
StoreMessage adds the message to the storage layer and solidifies it.
func (*TestEnvironment) UTXO ¶ added in v1.0.0
func (te *TestEnvironment) UTXO() *utxo.Manager
func (*TestEnvironment) VerifyCMI ¶ added in v1.0.0
func (te *TestEnvironment) VerifyCMI(index milestone.Index)
VerifyCMI checks if the confirmed milestone index is equal to the given milestone index.
func (*TestEnvironment) VerifyLMI ¶
func (te *TestEnvironment) VerifyLMI(index milestone.Index)
VerifyLMI checks if the latest milestone index is equal to the given milestone index.