Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 1332b8b

Browse files
jonastheiskarimodmpiotrm50
authored
In memory ConflictDAG and transaction and attachment orphanage (#2532)
Co-authored-by: Andrea V <1577639+karimodm@users.noreply.github.com> Co-authored-by: Piotr Macek <piotr.macek@iota.org>
1 parent bd79fd3 commit 1332b8b

138 files changed

Lines changed: 3040 additions & 2892 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ tools/
1515

1616
# Database directory
1717
mainnetdb/
18+
db/
19+
retainer/
1820

1921
plugins/dashboard/frontend/node_modules/
2022
plugins/dagsvisualizer/frontend/node_modules/

client/evilspammer/spammer.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"github.com/pkg/errors"
77

88
"github.com/iotaledger/goshimmer/client/evilwallet"
9-
"github.com/iotaledger/goshimmer/packages/protocol/ledger/utxo"
109
"github.com/iotaledger/goshimmer/packages/protocol/ledger/vm/devnetvm"
1110

1211
"github.com/iotaledger/hive.go/app/configuration"
@@ -208,12 +207,10 @@ func (s *Spammer) PostTransaction(tx *devnetvm.Transaction, clt evilwallet.Clien
208207
return
209208
}
210209

211-
var err error
212-
var txID utxo.TransactionID
213-
if err = evilwallet.RateSetterSleep(clt, s.UseRateSetter); err != nil {
210+
if err := evilwallet.RateSetterSleep(clt, s.UseRateSetter); err != nil {
214211
return
215212
}
216-
txID, err = clt.PostTransaction(tx)
213+
txID, blockID, err := clt.PostTransaction(tx)
217214
if err != nil {
218215
s.log.Debug(ErrFailPostTransaction)
219216
s.ErrCounter.CountError(errors.WithMessage(ErrFailPostTransaction, err.Error()))
@@ -224,7 +221,7 @@ func (s *Spammer) PostTransaction(tx *devnetvm.Transaction, clt evilwallet.Clien
224221
}
225222

226223
count := s.State.txSent.Add(1)
227-
s.log.Debugf("Last transaction sent, ID: %s, txCount: %d", txID.String(), count)
224+
s.log.Debugf("%s: Last transaction sent, ID: %s, txCount: %d", blockID.Base58(), txID.Base58(), count)
228225
}
229226

230227
func (s *Spammer) handleSolidityForReuseOutputs(clt evilwallet.Client, tx *devnetvm.Transaction) (ok bool) {

client/evilwallet/connector.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import (
55
"time"
66

77
"github.com/iotaledger/hive.go/core/identity"
8-
"github.com/iotaledger/hive.go/core/types/confirmation"
8+
9+
"github.com/iotaledger/goshimmer/packages/core/confirmation"
910

1011
"github.com/iotaledger/goshimmer/client"
1112
"github.com/iotaledger/goshimmer/client/wallet"
1213
"github.com/iotaledger/goshimmer/packages/app/jsonmodels"
1314
"github.com/iotaledger/goshimmer/packages/protocol/ledger/utxo"
1415
"github.com/iotaledger/goshimmer/packages/protocol/ledger/vm/devnetvm"
16+
"github.com/iotaledger/goshimmer/packages/protocol/models"
1517
)
1618

1719
type ServersStatus []*wallet.ServerStatus
@@ -172,7 +174,7 @@ type Client interface {
172174
// SleepRateSetterEstimate sleeps for rate setter estimate.
173175
SleepRateSetterEstimate() (err error)
174176
// PostTransaction sends a transaction to the Tangle via a given client.
175-
PostTransaction(tx *devnetvm.Transaction) (utxo.TransactionID, error)
177+
PostTransaction(tx *devnetvm.Transaction) (utxo.TransactionID, models.BlockID, error)
176178
// PostData sends the given data (payload) by creating a block in the backend.
177179
PostData(data []byte) (blkID string, err error)
178180
// GetUnspentOutputForAddress gets the first unspent outputs of a given address.
@@ -239,7 +241,7 @@ func (c *WebClient) BroadcastFaucetRequest(address string, powTarget int) (err e
239241
}
240242

241243
// PostTransaction sends a transaction to the Tangle via a given client.
242-
func (c *WebClient) PostTransaction(tx *devnetvm.Transaction) (txID utxo.TransactionID, err error) {
244+
func (c *WebClient) PostTransaction(tx *devnetvm.Transaction) (txID utxo.TransactionID, blockID models.BlockID, err error) {
243245
txBytes, err := tx.Bytes()
244246
if err != nil {
245247
return
@@ -253,6 +255,10 @@ func (c *WebClient) PostTransaction(tx *devnetvm.Transaction) (txID utxo.Transac
253255
if err != nil {
254256
return
255257
}
258+
err = blockID.FromBase58(resp.BlockID)
259+
if err != nil {
260+
return
261+
}
256262
return
257263
}
258264

client/evilwallet/evilwallet.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const (
3232
)
3333

3434
var (
35-
defaultClientsURLs = []string{"http://localhost:8080", "http://localhost:8090"}
35+
defaultClientsURLs = []string{}
3636
faucetBalance = devnetvm.NewColoredBalances(map[devnetvm.Color]uint64{
3737
devnetvm.ColorIOTA: uint64(faucetTokensPerRequest),
3838
})
@@ -260,7 +260,7 @@ func (e *EvilWallet) splitOutputs(inputWallet, outputWallet *Wallet, splitNumber
260260
if err = RateSetterSleep(clt, true); err != nil {
261261
return
262262
}
263-
txID, err := clt.PostTransaction(tx)
263+
txID, _, err := clt.PostTransaction(tx)
264264
if err != nil {
265265
return
266266
}
@@ -345,7 +345,7 @@ func (e *EvilWallet) SendCustomConflicts(conflictsMaps []ConflictSlice) (err err
345345
if err = RateSetterSleep(clt, true); err != nil {
346346
return
347347
}
348-
_, _ = clt.PostTransaction(tx)
348+
_, _, _ = clt.PostTransaction(tx)
349349
}(clients[i], tx)
350350
}
351351
wg.Wait()

client/wallet/connector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package wallet
22

33
import (
4-
"github.com/iotaledger/hive.go/core/types/confirmation"
4+
"github.com/iotaledger/goshimmer/packages/core/confirmation"
55

66
"github.com/iotaledger/goshimmer/client/wallet/packages/address"
77
"github.com/iotaledger/goshimmer/packages/protocol/ledger/utxo"

client/wallet/webconnector.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package wallet
22

33
import (
44
"github.com/iotaledger/hive.go/core/generics/lo"
5-
"github.com/iotaledger/hive.go/core/types/confirmation"
65
"github.com/pkg/errors"
76

7+
"github.com/iotaledger/goshimmer/packages/core/confirmation"
8+
89
"github.com/iotaledger/goshimmer/client"
910
"github.com/iotaledger/goshimmer/client/wallet/packages/address"
1011
"github.com/iotaledger/goshimmer/packages/protocol/ledger/utxo"

0 commit comments

Comments
 (0)