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

Merge branch 'develop' into integration/value

parents d145fbc5 3f86f9a8
No related branches found
No related tags found
No related merge requests found
name: Publish Docker develop
on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Publish to registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: iotagoshimmer/goshimmer
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "develop"
...@@ -166,8 +166,7 @@ func (tangle *Tangle) BranchManager() *branchmanager.BranchManager { ...@@ -166,8 +166,7 @@ func (tangle *Tangle) BranchManager() *branchmanager.BranchManager {
} }
// LoadSnapshot creates a set of outputs in the value tangle, that are forming the genesis for future transactions. // LoadSnapshot creates a set of outputs in the value tangle, that are forming the genesis for future transactions.
func (tangle *Tangle) LoadSnapshot(snapshot Snapshot) { func (tangle *Tangle) LoadSnapshot(snapshot map[transaction.ID]map[address.Address][]*balance.Balance) {
// TODO: snapshot should also reflect the consumers of transactions
for transactionID, addressBalances := range snapshot { for transactionID, addressBalances := range snapshot {
for outputAddress, balances := range addressBalances { for outputAddress, balances := range addressBalances {
input := NewOutput(outputAddress, transactionID, branchmanager.MasterBranchID, balances) input := NewOutput(outputAddress, transactionID, branchmanager.MasterBranchID, balances)
...@@ -235,7 +234,7 @@ func (tangle *Tangle) Fork(transactionID transaction.ID, conflictingInputs []tra ...@@ -235,7 +234,7 @@ func (tangle *Tangle) Fork(transactionID transaction.ID, conflictingInputs []tra
} }
// trigger events + set result // trigger events + set result
tangle.Events.Fork.Trigger(cachedTransaction, cachedTransactionMetadata, cachedTargetBranch, conflictingInputs) tangle.Events.Fork.Trigger(cachedTransaction, cachedTransactionMetadata)
forked = true forked = true
return return
...@@ -1299,9 +1298,26 @@ func (tangle *Tangle) bookTransaction(cachedTransaction *transaction.CachedTrans ...@@ -1299,9 +1298,26 @@ func (tangle *Tangle) bookTransaction(cachedTransaction *transaction.CachedTrans
// book transaction into target branch // book transaction into target branch
transactionMetadata.SetBranchID(targetBranch.ID()) transactionMetadata.SetBranchID(targetBranch.ID())
// create color for newly minted coins
mintedColor, _, err := balance.ColorFromBytes(transactionToBook.ID().Bytes())
if err != nil {
panic(err) // this should never happen (a transaction id is always a valid color)
}
// book outputs into the target branch // book outputs into the target branch
transactionToBook.Outputs().ForEach(func(address address.Address, balances []*balance.Balance) bool { transactionToBook.Outputs().ForEach(func(address address.Address, balances []*balance.Balance) bool {
newOutput := NewOutput(address, transactionToBook.ID(), targetBranch.ID(), balances) // create correctly colored balances (replacing color of newly minted coins with color of transaction id)
coloredBalances := make([]*balance.Balance, len(balances))
for i, currentBalance := range balances {
if currentBalance.Color == balance.ColorNew {
coloredBalances[i] = balance.New(mintedColor, currentBalance.Value)
} else {
coloredBalances[i] = currentBalance
}
}
// store output
newOutput := NewOutput(address, transactionToBook.ID(), targetBranch.ID(), coloredBalances)
newOutput.setSolid(true) newOutput.setSolid(true)
tangle.outputStorage.Store(newOutput).Release() tangle.outputStorage.Store(newOutput).Release()
...@@ -1891,4 +1907,4 @@ func (stackEntry *valuePayloadPropagationStackEntry) Unwrap() (payload *payload. ...@@ -1891,4 +1907,4 @@ func (stackEntry *valuePayloadPropagationStackEntry) Unwrap() (payload *payload.
transactionMetadata = stackEntry.CachedTransactionMetadata.Unwrap() transactionMetadata = stackEntry.CachedTransactionMetadata.Unwrap()
return return
} }
\ No newline at end of file
...@@ -1518,4 +1518,4 @@ func createDummyTransaction() *transaction.Transaction { ...@@ -1518,4 +1518,4 @@ func createDummyTransaction() *transaction.Transaction {
}, },
}), }),
) )
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ require ( ...@@ -15,7 +15,7 @@ require (
github.com/drand/kyber v1.0.1-0.20200331114745-30e90cc60f99 github.com/drand/kyber v1.0.1-0.20200331114745-30e90cc60f99
github.com/gobuffalo/packr/v2 v2.7.1 github.com/gobuffalo/packr/v2 v2.7.1
github.com/golang/protobuf v1.3.5 github.com/golang/protobuf v1.3.5
github.com/google/go-cmp v0.4.0 github.com/google/go-cmp v0.4.1
github.com/gorilla/websocket v1.4.1 github.com/gorilla/websocket v1.4.1
github.com/iotaledger/hive.go v0.0.0-20200610104211-d603429af242 github.com/iotaledger/hive.go v0.0.0-20200610104211-d603429af242
github.com/iotaledger/iota.go v1.0.0-beta.14 github.com/iotaledger/iota.go v1.0.0-beta.14
......
...@@ -3,6 +3,7 @@ package config ...@@ -3,6 +3,7 @@ package config
import ( import (
"fmt" "fmt"
"os" "os"
"strings"
"github.com/iotaledger/hive.go/events" "github.com/iotaledger/hive.go/events"
"github.com/iotaledger/hive.go/node" "github.com/iotaledger/hive.go/node"
...@@ -56,6 +57,12 @@ func init() { ...@@ -56,6 +57,12 @@ func init() {
// It automatically reads in a single config file starting with "config" (can be changed via the --config CLI flag) // It automatically reads in a single config file starting with "config" (can be changed via the --config CLI flag)
// and ending with: .json, .toml, .yaml or .yml (in this sequence). // and ending with: .json, .toml, .yaml or .yml (in this sequence).
func fetch(printConfig bool, ignoreSettingsAtPrint ...[]string) error { func fetch(printConfig bool, ignoreSettingsAtPrint ...[]string) error {
// replace dots with underscores in env
dotReplacer := strings.NewReplacer(".", "_")
Node.SetEnvKeyReplacer(dotReplacer)
// read in ENV variables
Node.AutomaticEnv()
flag.Parse() flag.Parse()
err := parameter.LoadConfigFile(Node, *configDirPath, *configName, true, *skipConfigAvailable) err := parameter.LoadConfigFile(Node, *configDirPath, *configName, true, *skipConfigAvailable)
if err != nil { if err != nil {
......
...@@ -2,6 +2,7 @@ package info ...@@ -2,6 +2,7 @@ package info
import ( import (
"net/http" "net/http"
"sort"
"github.com/iotaledger/goshimmer/plugins/autopeering/local" "github.com/iotaledger/goshimmer/plugins/autopeering/local"
"github.com/iotaledger/goshimmer/plugins/banner" "github.com/iotaledger/goshimmer/plugins/banner"
...@@ -60,16 +61,16 @@ func getInfo(c echo.Context) error { ...@@ -60,16 +61,16 @@ func getInfo(c echo.Context) error {
var enabledPlugins []string var enabledPlugins []string
var disabledPlugins []string var disabledPlugins []string
for pluginName, plugin := range node.GetPlugins() { for pluginName, plugin := range node.GetPlugins() {
switch plugin.Status { if node.IsSkipped(plugin) {
case node.Disabled:
disabledPlugins = append(disabledPlugins, pluginName) disabledPlugins = append(disabledPlugins, pluginName)
case node.Enabled: } else {
enabledPlugins = append(enabledPlugins, pluginName) enabledPlugins = append(enabledPlugins, pluginName)
default:
continue
} }
} }
sort.Strings(enabledPlugins)
sort.Strings(disabledPlugins)
return c.JSON(http.StatusOK, Response{ return c.JSON(http.StatusOK, Response{
Version: banner.AppVersion, Version: banner.AppVersion,
Synced: sync.Synced(), Synced: sync.Synced(),
...@@ -89,11 +90,11 @@ type Response struct { ...@@ -89,11 +90,11 @@ type Response struct {
// identity ID of the node encoded in base58 and truncated to its first 8 bytes // identity ID of the node encoded in base58 and truncated to its first 8 bytes
IdentityID string `json:"identityID,omitempty"` IdentityID string `json:"identityID,omitempty"`
// public key of the node encoded in base58 // public key of the node encoded in base58
PublicKey string `json:"publickey,omitempty"` PublicKey string `json:"publicKey,omitempty"`
// list of enabled plugins // list of enabled plugins
EnabledPlugins []string `json:"enabledplugins,omitempty"` EnabledPlugins []string `json:"enabledPlugins,omitempty"`
// list if disabled plugins // list if disabled plugins
DisabledPlugins []string `json:"disabledlugins,omitempty"` DisabledPlugins []string `json:"disabledPlugins,omitempty"`
// error of the response // error of the response
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
...@@ -36,7 +36,6 @@ func Handler(c echo.Context) error { ...@@ -36,7 +36,6 @@ func Handler(c echo.Context) error {
// TODO: don't do this in a for // TODO: don't do this in a for
defer cachedTxMeta.Release() defer cachedTxMeta.Release()
// TODO: get inclusion state
if output.ConsumerCount() == 0 { if output.ConsumerCount() == 0 {
// iterate balances // iterate balances
var b []utils.Balance var b []utils.Balance
......
...@@ -64,11 +64,11 @@ type Balance struct { ...@@ -64,11 +64,11 @@ type Balance struct {
// InclusionState represents the different states of an OutputID // InclusionState represents the different states of an OutputID
type InclusionState struct { type InclusionState struct {
Confirmed bool `json:"confirmed,omitempty"`
Conflict bool `json:"conflict,omitempty"`
Liked bool `json:"liked,omitempty"`
Solid bool `json:"solid,omitempty"` Solid bool `json:"solid,omitempty"`
Confirmed bool `json:"confirmed,omitempty"`
Rejected bool `json:"rejected,omitempty"` Rejected bool `json:"rejected,omitempty"`
Liked bool `json:"liked,omitempty"`
Conflict bool `json:"conflict,omitempty"`
Finalized bool `json:"finalized,omitempty"` Finalized bool `json:"finalized,omitempty"`
Preferred bool `json:"preferred,omitempty"` Preferred bool `json:"preferred,omitempty"`
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment