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