Skip to content
Snippets Groups Projects
Unverified Commit ff1dbb80 authored by jkrvivian's avatar jkrvivian
Browse files

refactor: Make testSnapshots disabled in default and minor tweaks

parent 08a53234
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ const (
var (
// Plugin is the plugin instance of the bootstrap plugin.
Plugin = node.NewPlugin(PluginName, node.Enabled, configure, run)
Plugin = node.NewPlugin(PluginName, node.Disabled, configure, run)
log *logger.Logger
// addresses for snapshots
......
......@@ -90,6 +90,7 @@ func (d *DockerContainer) CreateGoShimmerPeer(config GoShimmerConfig) error {
}
if config.Faucet {
plugins = append(plugins, "faucet")
plugins = append(plugins, "testSnapshots")
}
return strings.Join(plugins[:], ",")
}()),
......
......@@ -159,16 +159,21 @@ func SendIotaValueMessages(t *testing.T, from *framework.Peer, to *framework.Pee
inputAddr := from.Seed().Address(0)
outputAddr := to.Seed().Address(0)
// abort if no unspent outputs
if addrBalance[inputAddr.String()][balance.ColorIOTA] < sentValue {
return true, ""
}
// prepare inputs
resp, err := from.GetUnspentOutputs([]string{inputAddr.String()})
require.NoErrorf(t, err, "Could not get unspent outputs on %s", from.String())
// abort if no unspent outputs
if len(resp.UnspentOutputs[0].OutputIDs) == 0 {
return true, ""
}
availableValue := resp.UnspentOutputs[0].OutputIDs[0].Balances[0].Value
//abort if the balance is not enough
if availableValue < sentValue {
return true, ""
}
out, err := transaction.OutputIDFromBase58(resp.UnspentOutputs[0].OutputIDs[0].ID)
require.NoErrorf(t, err, "Invalid unspent outputs ID on %s", from.String())
inputs := transaction.NewInputs([]transaction.OutputID{out}...)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment