Skip to content
Snippets Groups Projects
Commit b19a815d authored by Luca Moser's avatar Luca Moser
Browse files

fixes relay-chcker tool

parent d08572be
No related branches found
No related tags found
No related merge requests found
...@@ -5,23 +5,21 @@ import ( ...@@ -5,23 +5,21 @@ import (
"time" "time"
client "github.com/iotaledger/goshimmer/client" client "github.com/iotaledger/goshimmer/client"
"github.com/iotaledger/goshimmer/packages/errors"
"github.com/iotaledger/iota.go/trinary" "github.com/iotaledger/iota.go/trinary"
) )
func testBroadcastData(api *client.GoShimmerAPI) (trinary.Hash, error) { func testBroadcastData(api *client.GoShimmerAPI) (trinary.Hash, error) {
txnHash, err := api.BroadcastData(txnAddr, txnData) txnHash, err := api.BroadcastData(txnAddr, txnData)
if err != nil { if err != nil {
return "", errors.Wrapf(err, "Broadcast failed") return "", fmt.Errorf("broadcast failed: %w", err)
} }
return txnHash, nil return txnHash, nil
} }
func testTargetGetTransactions(api *client.GoShimmerAPI, txnHash trinary.Hash) error { func testTargetGetTransactions(api *client.GoShimmerAPI, txnHash trinary.Hash) error {
// query target node for broadcasted data // query target node for broadcasted data
_, err := api.GetTransactionObjectsByHash([]trinary.Hash{txnHash}) if _, err := api.GetTransactionObjectsByHash([]trinary.Hash{txnHash}); err != nil {
if err != nil { return fmt.Errorf("querying the target node failed: %w", err)
return errors.Wrapf(err, "Query target failed")
} }
return nil return nil
} }
...@@ -30,11 +28,10 @@ func testNodesGetTransactions(txnHash trinary.Hash) error { ...@@ -30,11 +28,10 @@ func testNodesGetTransactions(txnHash trinary.Hash) error {
// query nodes node for broadcasted data // query nodes node for broadcasted data
for _, n := range nodes { for _, n := range nodes {
nodesApi := client.NewGoShimmerAPI(n) nodesApi := client.NewGoShimmerAPI(n)
_, err := nodesApi.GetTransactionObjectsByHash([]trinary.Hash{txnHash}) if _, err := nodesApi.GetTransactionObjectsByHash([]trinary.Hash{txnHash}); err != nil {
if err != nil { return fmt.Errorf("querying node %s failed: %w", n, err)
return errors.Wrapf(err, "Query %s failed", n)
} }
fmt.Printf("txn found in %s\n", n) fmt.Printf("txn found in node %s\n", n)
} }
return nil return nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment