diff --git a/packages/model/value_transaction/value_transaction.go b/packages/model/value_transaction/value_transaction.go index 25e98607332e486747615763e4629066aeebda4d..f0470a401311c2feeac92823044efa02f0a503b9 100644 --- a/packages/model/value_transaction/value_transaction.go +++ b/packages/model/value_transaction/value_transaction.go @@ -182,7 +182,7 @@ func (this *ValueTransaction) SetTimestamp(timestamp uint) bool { this.timestamp = ×tamp this.BlockHasher() - copy(this.trits[TIMESTAMP_OFFSET:TIMESTAMP_END], trinary.IntToTrits(int64(timestamp))[:TIMESTAMP_SIZE]) + copy(this.trits[TIMESTAMP_OFFSET:TIMESTAMP_END], trinary.PadTrits(trinary.IntToTrits(int64(timestamp)), TIMESTAMP_SIZE)[:TIMESTAMP_SIZE]) this.UnblockHasher() this.SetModified(true) diff --git a/packages/transactionspammer/transactionspammer.go b/packages/transactionspammer/transactionspammer.go index 777671a2e5fb8338f34de4baa08c44ba73a4baf0..9b9fe4a37ff2b40c3c39e1ee3c2c410a0f0d63de 100644 --- a/packages/transactionspammer/transactionspammer.go +++ b/packages/transactionspammer/transactionspammer.go @@ -18,6 +18,8 @@ var shutdownSignal chan int var sentCounter = uint(0) +var totalSentCounter = uint(0) + func Start(tps uint) { startMutex.Lock() @@ -28,7 +30,6 @@ func Start(tps uint) { daemon.BackgroundWorker("Transaction Spammer", func() { for { start := time.Now() - totalSentCounter := int64(0) for { select { @@ -39,15 +40,9 @@ func Start(tps uint) { return default: - sentCounter++ - totalSentCounter++ - - tx := value_transaction.New() - tx.SetValue(totalSentCounter) - tx.SetBranchTransactionHash(tipselection.GetRandomTip()) - tx.SetTrunkTransactionHash(tipselection.GetRandomTip()) - - gossip.Events.ReceiveTransaction.Trigger(tx.MetaTransaction) + for _, bundleTransaction := range GenerateBundle(3) { + gossip.Events.ReceiveTransaction.Trigger(bundleTransaction.MetaTransaction) + } if sentCounter >= tps { duration := time.Since(start) @@ -90,10 +85,13 @@ func GenerateBundle(bundleLength int) (result []*value_transaction.ValueTransact trunk := tipselection.GetRandomTip() for i := 0; i < bundleLength; i++ { + sentCounter++ + totalSentCounter++ + tx := value_transaction.New() tx.SetTail(i == 0) - tx.SetHead(i == bundleLength - 1) - tx.SetTimestamp(sentCounter) + tx.SetHead(i == bundleLength-1) + tx.SetTimestamp(totalSentCounter) tx.SetBranchTransactionHash(branch) tx.SetTrunkTransactionHash(trunk) diff --git a/plugins/bundleprocessor/bundleprocessor_test.go b/plugins/bundleprocessor/bundleprocessor_test.go index a4853715920a651d6f96a3f47b7e452ee6a506db..989c67d55770ab6887ae194758ca3c1a9f08c974 100644 --- a/plugins/bundleprocessor/bundleprocessor_test.go +++ b/plugins/bundleprocessor/bundleprocessor_test.go @@ -15,6 +15,9 @@ import ( ) func TestProcessSolidBundleHead(t *testing.T) { + // show all error messages for tests + *node.LOG_LEVEL.Value = node.LOG_LEVEL_DEBUG + // start a test node node.Start(tangle.PLUGIN, PLUGIN) diff --git a/plugins/webapi-spammer/plugin.go b/plugins/webapi-spammer/plugin.go index b216aca5e0f9d3e905eb30b898b6066f4dd42c72..4823ac75ce19225b142c4029003848be1bf0a307 100644 --- a/plugins/webapi-spammer/plugin.go +++ b/plugins/webapi-spammer/plugin.go @@ -69,5 +69,5 @@ type webResponse struct { type webRequest struct { Cmd string `json:"cmd"` - Tps int64 `json:"tps"` + Tps uint `json:"tps"` } diff --git a/plugins/webapi/plugin.go b/plugins/webapi/plugin.go index 4d80bdad8550809452b03c53e786f0836b0da6b5..f19c9e47b2a991a354a4cb05422b06a62b0996ba 100644 --- a/plugins/webapi/plugin.go +++ b/plugins/webapi/plugin.go @@ -16,6 +16,7 @@ var Server = echo.New() func configure(plugin *node.Plugin) { Server.HideBanner = true + Server.HidePort = true Server.GET("/", IndexRequest) daemon.Events.Shutdown.Attach(events.NewClosure(func() {