Skip to content
Snippets Groups Projects
Unverified Commit 12eefe1c authored by Luca Moser's avatar Luca Moser Committed by GitHub
Browse files

Updates to iota.go v1.0.0-beta.14 (#133)


* updates to iota.go v1.0.0-beta.14

* Use trinary.Must..

Co-authored-by: default avatarWolfgang Welz <welzwo@gmail.com>
parent db7c2e5b
Branches
Tags
No related merge requests found
...@@ -14,7 +14,7 @@ require ( ...@@ -14,7 +14,7 @@ require (
github.com/googollee/go-socket.io v1.4.3-0.20191204093753-683f8725b6d0 github.com/googollee/go-socket.io v1.4.3-0.20191204093753-683f8725b6d0
github.com/gorilla/websocket v1.4.1 github.com/gorilla/websocket v1.4.1
github.com/iotaledger/hive.go v0.0.0-20200110132858-ea86cdb9d91e github.com/iotaledger/hive.go v0.0.0-20200110132858-ea86cdb9d91e
github.com/iotaledger/iota.go v1.0.0-beta.13 github.com/iotaledger/iota.go v1.0.0-beta.14
github.com/labstack/echo v3.3.10+incompatible github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.3.0 // indirect github.com/labstack/gommon v0.3.0 // indirect
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
...@@ -23,7 +23,7 @@ require ( ...@@ -23,7 +23,7 @@ require (
github.com/mattn/go-isatty v0.0.11 // indirect github.com/mattn/go-isatty v0.0.11 // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/pelletier/go-toml v1.6.0 // indirect github.com/pelletier/go-toml v1.6.0 // indirect
github.com/pkg/errors v0.8.1 github.com/pkg/errors v0.9.1
github.com/rivo/tview v0.0.0-20191229165609-1ee8d9874dcf github.com/rivo/tview v0.0.0-20191229165609-1ee8d9874dcf
github.com/spf13/afero v1.2.2 // indirect github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect github.com/spf13/cast v1.3.1 // indirect
......
...@@ -22,6 +22,7 @@ github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NR ...@@ -22,6 +22,7 @@ github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NR
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
...@@ -118,8 +119,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt ...@@ -118,8 +119,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/iotaledger/hive.go v0.0.0-20200110132858-ea86cdb9d91e h1:bowQHvFQoUWPgxlF9cQRWDzREswR09HpihMiNX1q+AU= github.com/iotaledger/hive.go v0.0.0-20200110132858-ea86cdb9d91e h1:bowQHvFQoUWPgxlF9cQRWDzREswR09HpihMiNX1q+AU=
github.com/iotaledger/hive.go v0.0.0-20200110132858-ea86cdb9d91e/go.mod h1:obs07gqna53/Yw1ltzLsQzJBMyA6lGu7Fb/ltjqWMnQ= github.com/iotaledger/hive.go v0.0.0-20200110132858-ea86cdb9d91e/go.mod h1:obs07gqna53/Yw1ltzLsQzJBMyA6lGu7Fb/ltjqWMnQ=
github.com/iotaledger/iota.go v1.0.0-beta.9/go.mod h1:F6WBmYd98mVjAmmPVYhnxg8NNIWCjjH8VWT9qvv3Rc8= github.com/iotaledger/iota.go v1.0.0-beta.9/go.mod h1:F6WBmYd98mVjAmmPVYhnxg8NNIWCjjH8VWT9qvv3Rc8=
github.com/iotaledger/iota.go v1.0.0-beta.13 h1:6m6JRcKtjTflU2PbjvDA9Tv6NTEJX1PijBDOkH9weQc= github.com/iotaledger/iota.go v1.0.0-beta.14 h1:Oeb28MfBuJEeXcGrLhTCJFtbsnc8y1u7xidsAmiOD5A=
github.com/iotaledger/iota.go v1.0.0-beta.13/go.mod h1:F6WBmYd98mVjAmmPVYhnxg8NNIWCjjH8VWT9qvv3Rc8= github.com/iotaledger/iota.go v1.0.0-beta.14/go.mod h1:F6WBmYd98mVjAmmPVYhnxg8NNIWCjjH8VWT9qvv3Rc8=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
...@@ -180,6 +181,8 @@ github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCr ...@@ -180,6 +181,8 @@ github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCr
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
......
...@@ -37,7 +37,7 @@ func (bundleFactory *BundleFactory) AddOutput(address *Address, value int64, mes ...@@ -37,7 +37,7 @@ func (bundleFactory *BundleFactory) AddOutput(address *Address, value int64, mes
bundleFactory.outputs = append(bundleFactory.outputs, bundleFactoryOutputEntry{ bundleFactory.outputs = append(bundleFactory.outputs, bundleFactoryOutputEntry{
address: address, address: address,
value: value, value: value,
message: trinary.Pad(messageTrytes, value_transaction.SIGNATURE_MESSAGE_FRAGMENT_SIZE), message: trinary.MustPad(messageTrytes, value_transaction.SIGNATURE_MESSAGE_FRAGMENT_SIZE),
}) })
} else { } else {
bundleFactory.outputs = append(bundleFactory.outputs, bundleFactoryOutputEntry{ bundleFactory.outputs = append(bundleFactory.outputs, bundleFactoryOutputEntry{
......
...@@ -53,11 +53,7 @@ func FromTrits(trits trinary.Trits) *MetaTransaction { ...@@ -53,11 +53,7 @@ func FromTrits(trits trinary.Trits) *MetaTransaction {
} }
func FromBytes(bytes []byte) (result *MetaTransaction) { func FromBytes(bytes []byte) (result *MetaTransaction) {
trits, err := trinary.BytesToTrits(bytes) trits := trinary.MustBytesToTrits(bytes)
if err != nil {
panic(err)
}
result = FromTrits(trits[:MARSHALED_TOTAL_SIZE]) result = FromTrits(trits[:MARSHALED_TOTAL_SIZE])
result.bytes = bytes result.bytes = bytes
...@@ -477,7 +473,7 @@ func (this *MetaTransaction) GetBytes() (result []byte) { ...@@ -477,7 +473,7 @@ func (this *MetaTransaction) GetBytes() (result []byte) {
defer this.bytesMutex.Unlock() defer this.bytesMutex.Unlock()
this.hasherMutex.Lock() this.hasherMutex.Lock()
this.bytes = trinary.TritsToBytes(this.trits) this.bytes = trinary.MustTritsToBytes(this.trits)
this.hasherMutex.Unlock() this.hasherMutex.Unlock()
} else { } else {
this.bytesMutex.RUnlock() this.bytesMutex.RUnlock()
......
...@@ -40,11 +40,7 @@ func FromMetaTransaction(metaTransaction *meta_transaction.MetaTransaction) *Val ...@@ -40,11 +40,7 @@ func FromMetaTransaction(metaTransaction *meta_transaction.MetaTransaction) *Val
} }
func FromBytes(bytes []byte) (result *ValueTransaction) { func FromBytes(bytes []byte) (result *ValueTransaction) {
trits, err := trinary.BytesToTrits(bytes) trits := trinary.MustBytesToTrits(bytes)
if err != nil {
panic(err)
}
result = &ValueTransaction{ result = &ValueTransaction{
MetaTransaction: meta_transaction.FromTrits(trits[:meta_transaction.MARSHALED_TOTAL_SIZE]), MetaTransaction: meta_transaction.FromTrits(trits[:meta_transaction.MARSHALED_TOTAL_SIZE]),
} }
...@@ -180,7 +176,7 @@ func (this *ValueTransaction) SetTimestamp(timestamp uint) bool { ...@@ -180,7 +176,7 @@ func (this *ValueTransaction) SetTimestamp(timestamp uint) bool {
this.timestamp = &timestamp this.timestamp = &timestamp
this.BlockHasher() this.BlockHasher()
copy(this.trits[TIMESTAMP_OFFSET:TIMESTAMP_END], trinary.PadTrits(trinary.IntToTrits(int64(timestamp)), TIMESTAMP_SIZE)[:TIMESTAMP_SIZE]) copy(this.trits[TIMESTAMP_OFFSET:TIMESTAMP_END], trinary.MustPadTrits(trinary.IntToTrits(int64(timestamp)), TIMESTAMP_SIZE)[:TIMESTAMP_SIZE])
this.UnblockHasher() this.UnblockHasher()
this.SetModified(true) this.SetModified(true)
......
...@@ -39,11 +39,7 @@ func getTrytes(c echo.Context) error { ...@@ -39,11 +39,7 @@ func getTrytes(c echo.Context) error {
return requestFailed(c, err.Error()) return requestFailed(c, err.Error())
} }
if tx != nil { if tx != nil {
trytes, err := trinary.TritsToTrytes(tx.GetTrits()) trytes := trinary.MustTritsToTrytes(tx.GetTrits())
// Returns an error if len(tx.GetTrits())%3!=0
if err != nil {
return requestFailed(c, err.Error())
}
result = append(result, trytes) result = append(result, trytes)
} else { } else {
//tx not found //tx not found
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment