Skip to content
Snippets Groups Projects
Commit 276ed127 authored by Hans Moog's avatar Hans Moog
Browse files

Refactor: renamed trinary to trytes (wolfgang was angry about it)

parent c30efe38
Branches
Tags
No related merge requests found
Showing
with 113 additions and 112 deletions
...@@ -77,7 +77,7 @@ func (this *BatchHasher) processHashes(collectedHashRequests []HashRequest) { ...@@ -77,7 +77,7 @@ func (this *BatchHasher) processHashes(collectedHashRequests []HashRequest) {
for _, hashRequest := range collectedHashRequests { for _, hashRequest := range collectedHashRequests {
multiplexer.Add(hashRequest.input) multiplexer.Add(hashRequest.input)
} }
bcTrinary, err := multiplexer.Extract() bcTrits, err := multiplexer.Extract()
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
...@@ -85,7 +85,7 @@ func (this *BatchHasher) processHashes(collectedHashRequests []HashRequest) { ...@@ -85,7 +85,7 @@ func (this *BatchHasher) processHashes(collectedHashRequests []HashRequest) {
// calculate the hash // calculate the hash
bctCurl := NewBCTCurl(this.hashLength, this.rounds) bctCurl := NewBCTCurl(this.hashLength, this.rounds)
bctCurl.Reset() bctCurl.Reset()
bctCurl.Absorb(bcTrinary) bctCurl.Absorb(bcTrits)
// extract the results from the demultiplexer // extract the results from the demultiplexer
demux := ternary.NewBCTernaryDemultiplexer(bctCurl.Squeeze(243)) demux := ternary.NewBCTernaryDemultiplexer(bctCurl.Squeeze(243))
...@@ -105,9 +105,9 @@ func (this *BatchHasher) processHashes(collectedHashRequests []HashRequest) { ...@@ -105,9 +105,9 @@ func (this *BatchHasher) processHashes(collectedHashRequests []HashRequest) {
} }
} }
func (this *BatchHasher) Hash(trinary ternary.Trits) chan ternary.Trits { func (this *BatchHasher) Hash(trits ternary.Trits) chan ternary.Trits {
hashRequest := HashRequest{ hashRequest := HashRequest{
input: trinary, input: trits,
output: make(chan ternary.Trits, 1), output: make(chan ternary.Trits, 1),
} }
......
...@@ -10,7 +10,7 @@ type BCTCurl struct { ...@@ -10,7 +10,7 @@ type BCTCurl struct {
hashLength int hashLength int
numberOfRounds int numberOfRounds int
stateLength int stateLength int
state ternary.BCTrinary state ternary.BCTrits
cTransform func() cTransform func()
} }
...@@ -19,7 +19,7 @@ func NewBCTCurl(hashLength int, numberOfRounds int) *BCTCurl { ...@@ -19,7 +19,7 @@ func NewBCTCurl(hashLength int, numberOfRounds int) *BCTCurl {
hashLength: hashLength, hashLength: hashLength,
numberOfRounds: numberOfRounds, numberOfRounds: numberOfRounds,
stateLength: ternary.NUMBER_OF_TRITS_IN_A_TRYTE * hashLength, stateLength: ternary.NUMBER_OF_TRITS_IN_A_TRYTE * hashLength,
state: ternary.BCTrinary{ state: ternary.BCTrits{
Lo: make([]uint, ternary.NUMBER_OF_TRITS_IN_A_TRYTE*hashLength), Lo: make([]uint, ternary.NUMBER_OF_TRITS_IN_A_TRYTE*hashLength),
Hi: make([]uint, ternary.NUMBER_OF_TRITS_IN_A_TRYTE*hashLength), Hi: make([]uint, ternary.NUMBER_OF_TRITS_IN_A_TRYTE*hashLength),
}, },
...@@ -64,7 +64,7 @@ func (this *BCTCurl) Transform() { ...@@ -64,7 +64,7 @@ func (this *BCTCurl) Transform() {
} }
} }
func (this *BCTCurl) Absorb(bcTrits ternary.BCTrinary) { func (this *BCTCurl) Absorb(bcTrits ternary.BCTrits) {
length := len(bcTrits.Lo) length := len(bcTrits.Lo)
offset := 0 offset := 0
...@@ -89,8 +89,8 @@ func (this *BCTCurl) Absorb(bcTrits ternary.BCTrinary) { ...@@ -89,8 +89,8 @@ func (this *BCTCurl) Absorb(bcTrits ternary.BCTrinary) {
} }
} }
func (this *BCTCurl) Squeeze(tritCount int) ternary.BCTrinary { func (this *BCTCurl) Squeeze(tritCount int) ternary.BCTrits {
result := ternary.BCTrinary{ result := ternary.BCTrits{
Lo: make([]uint, tritCount), Lo: make([]uint, tritCount),
Hi: make([]uint, tritCount), Hi: make([]uint, tritCount),
} }
......
...@@ -45,10 +45,10 @@ func (curl *Curl) Initialize() { ...@@ -45,10 +45,10 @@ func (curl *Curl) Initialize() {
curl.InitializeCurl(nil, 0, curl.rounds) curl.InitializeCurl(nil, 0, curl.rounds)
} }
func (curl *Curl) InitializeCurl(trinary ternary.Trits, length int, rounds int) { func (curl *Curl) InitializeCurl(trits ternary.Trits, length int, rounds int) {
curl.rounds = rounds curl.rounds = rounds
if trinary != nil { if trits != nil {
curl.state = trinary curl.state = trits
} else { } else {
curl.state = make(ternary.Trits, STATE_LENGTH) curl.state = make(ternary.Trits, STATE_LENGTH)
} }
...@@ -58,10 +58,10 @@ func (curl *Curl) Reset() { ...@@ -58,10 +58,10 @@ func (curl *Curl) Reset() {
curl.InitializeCurl(nil, 0, curl.rounds) curl.InitializeCurl(nil, 0, curl.rounds)
} }
func (curl *Curl) Absorb(trinary ternary.Trits, offset int, length int) { func (curl *Curl) Absorb(trits ternary.Trits, offset int, length int) {
for { for {
limit := int(math.Min(HASH_LENGTH, float64(length))) limit := int(math.Min(HASH_LENGTH, float64(length)))
copy(curl.state, trinary[offset:offset+limit]) copy(curl.state, trits[offset:offset+limit])
curl.Transform() curl.Transform()
offset += HASH_LENGTH offset += HASH_LENGTH
length -= HASH_LENGTH length -= HASH_LENGTH
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
type Area struct { type Area struct {
olc.CodeArea olc.CodeArea
IACCode ternary.Trinary IACCode ternary.Trytes
OLCCode string OLCCode string
} }
......
...@@ -6,13 +6,13 @@ import ( ...@@ -6,13 +6,13 @@ import (
"github.com/iotaledger/goshimmer/packages/ternary" "github.com/iotaledger/goshimmer/packages/ternary"
) )
func Decode(trinary ternary.Trinary) (result *Area, err errors.IdentifiableError) { func Decode(trytes ternary.Trytes) (result *Area, err errors.IdentifiableError) {
if olcCode, conversionErr := OLCCodeFromTrinary(trinary); conversionErr != nil { if olcCode, conversionErr := OLCCodeFromTrytes(trytes); conversionErr != nil {
err = conversionErr err = conversionErr
} else { } else {
if codeArea, olcErr := olc.Decode(olcCode); olcErr == nil { if codeArea, olcErr := olc.Decode(olcCode); olcErr == nil {
result = &Area{ result = &Area{
IACCode: trinary, IACCode: trytes,
OLCCode: olcCode, OLCCode: olcCode,
CodeArea: codeArea, CodeArea: codeArea,
} }
......
...@@ -31,10 +31,10 @@ func init() { ...@@ -31,10 +31,10 @@ func init() {
IAC_TO_OLC_MAP[IAC_PADDING] = OLC_PADDING IAC_TO_OLC_MAP[IAC_PADDING] = OLC_PADDING
} }
func TrinaryFromOLCCode(code string) (result ternary.Trinary, err errors.IdentifiableError) { func TrytesFromOLCCode(code string) (result ternary.Trytes, err errors.IdentifiableError) {
for _, char := range code { for _, char := range code {
if translatedChar, exists := OLC_TO_IAC_MAP[char]; exists { if translatedChar, exists := OLC_TO_IAC_MAP[char]; exists {
result += ternary.Trinary(translatedChar) result += ternary.Trytes(translatedChar)
} else { } else {
err = ErrConversionFailed.Derive("invalid character in input") err = ErrConversionFailed.Derive("invalid character in input")
} }
...@@ -43,8 +43,8 @@ func TrinaryFromOLCCode(code string) (result ternary.Trinary, err errors.Identif ...@@ -43,8 +43,8 @@ func TrinaryFromOLCCode(code string) (result ternary.Trinary, err errors.Identif
return return
} }
func OLCCodeFromTrinary(trinary ternary.Trinary) (result string, err errors.IdentifiableError) { func OLCCodeFromTrytes(trytes ternary.Trytes) (result string, err errors.IdentifiableError) {
for _, char := range trinary { for _, char := range trytes {
if translatedChar, exists := IAC_TO_OLC_MAP[char]; exists { if translatedChar, exists := IAC_TO_OLC_MAP[char]; exists {
result += string(translatedChar) result += string(translatedChar)
} else { } else {
......
...@@ -11,35 +11,35 @@ import ( ...@@ -11,35 +11,35 @@ import (
) )
type Approvers struct { type Approvers struct {
hash ternary.Trinary hash ternary.Trytes
hashes map[ternary.Trinary]bool hashes map[ternary.Trytes]bool
hashesMutex sync.RWMutex hashesMutex sync.RWMutex
modified bool modified bool
} }
func New(hash ternary.Trinary) *Approvers { func New(hash ternary.Trytes) *Approvers {
return &Approvers{ return &Approvers{
hash: hash, hash: hash,
hashes: make(map[ternary.Trinary]bool), hashes: make(map[ternary.Trytes]bool),
modified: false, modified: false,
} }
} }
// region public methods with locking ////////////////////////////////////////////////////////////////////////////////// // region public methods with locking //////////////////////////////////////////////////////////////////////////////////
func (approvers *Approvers) Add(transactionHash ternary.Trinary) { func (approvers *Approvers) Add(transactionHash ternary.Trytes) {
approvers.hashesMutex.Lock() approvers.hashesMutex.Lock()
approvers.add(transactionHash) approvers.add(transactionHash)
approvers.hashesMutex.Unlock() approvers.hashesMutex.Unlock()
} }
func (approvers *Approvers) Remove(approverHash ternary.Trinary) { func (approvers *Approvers) Remove(approverHash ternary.Trytes) {
approvers.hashesMutex.Lock() approvers.hashesMutex.Lock()
approvers.remove(approverHash) approvers.remove(approverHash)
approvers.hashesMutex.Unlock() approvers.hashesMutex.Unlock()
} }
func (approvers *Approvers) GetHashes() (result []ternary.Trinary) { func (approvers *Approvers) GetHashes() (result []ternary.Trytes) {
approvers.hashesMutex.RLock() approvers.hashesMutex.RLock()
result = approvers.getHashes() result = approvers.getHashes()
approvers.hashesMutex.RUnlock() approvers.hashesMutex.RUnlock()
...@@ -47,7 +47,7 @@ func (approvers *Approvers) GetHashes() (result []ternary.Trinary) { ...@@ -47,7 +47,7 @@ func (approvers *Approvers) GetHashes() (result []ternary.Trinary) {
return return
} }
func (approvers *Approvers) GetHash() (result ternary.Trinary) { func (approvers *Approvers) GetHash() (result ternary.Trytes) {
approvers.hashesMutex.RLock() approvers.hashesMutex.RLock()
result = approvers.hash result = approvers.hash
approvers.hashesMutex.RUnlock() approvers.hashesMutex.RUnlock()
...@@ -101,13 +101,13 @@ func (approvers *Approvers) Unmarshal(data []byte) (err errors.IdentifiableError ...@@ -101,13 +101,13 @@ func (approvers *Approvers) Unmarshal(data []byte) (err errors.IdentifiableError
approvers.hashesMutex.Lock() approvers.hashesMutex.Lock()
approvers.hash = ternary.Trinary(typeutils.BytesToString(data[MARSHALED_APPROVERS_HASH_START:MARSHALED_APPROVERS_HASH_END])) approvers.hash = ternary.Trytes(typeutils.BytesToString(data[MARSHALED_APPROVERS_HASH_START:MARSHALED_APPROVERS_HASH_END]))
approvers.hashes = make(map[ternary.Trinary]bool, hashesCount) approvers.hashes = make(map[ternary.Trytes]bool, hashesCount)
for i := uint64(0); i < hashesCount; i++ { for i := uint64(0); i < hashesCount; i++ {
var HASH_START = MARSHALED_APPROVERS_HASHES_START + i*(MARSHALED_APPROVERS_HASH_SIZE) var HASH_START = MARSHALED_APPROVERS_HASHES_START + i*(MARSHALED_APPROVERS_HASH_SIZE)
var HASH_END = HASH_START * MARSHALED_APPROVERS_HASH_SIZE var HASH_END = HASH_START * MARSHALED_APPROVERS_HASH_SIZE
approvers.hashes[ternary.Trinary(typeutils.BytesToString(data[HASH_START:HASH_END]))] = true approvers.hashes[ternary.Trytes(typeutils.BytesToString(data[HASH_START:HASH_END]))] = true
} }
approvers.hashesMutex.Unlock() approvers.hashesMutex.Unlock()
...@@ -119,22 +119,22 @@ func (approvers *Approvers) Unmarshal(data []byte) (err errors.IdentifiableError ...@@ -119,22 +119,22 @@ func (approvers *Approvers) Unmarshal(data []byte) (err errors.IdentifiableError
// region private methods without locking ////////////////////////////////////////////////////////////////////////////// // region private methods without locking //////////////////////////////////////////////////////////////////////////////
func (approvers *Approvers) add(transactionHash ternary.Trinary) { func (approvers *Approvers) add(transactionHash ternary.Trytes) {
if _, exists := approvers.hashes[transactionHash]; !exists { if _, exists := approvers.hashes[transactionHash]; !exists {
approvers.hashes[transactionHash] = true approvers.hashes[transactionHash] = true
approvers.modified = true approvers.modified = true
} }
} }
func (approvers *Approvers) remove(approverHash ternary.Trinary) { func (approvers *Approvers) remove(approverHash ternary.Trytes) {
if _, exists := approvers.hashes[approverHash]; exists { if _, exists := approvers.hashes[approverHash]; exists {
delete(approvers.hashes, approverHash) delete(approvers.hashes, approverHash)
approvers.modified = true approvers.modified = true
} }
} }
func (approvers *Approvers) getHashes() (result []ternary.Trinary) { func (approvers *Approvers) getHashes() (result []ternary.Trytes) {
result = make([]ternary.Trinary, len(approvers.hashes)) result = make([]ternary.Trytes, len(approvers.hashes))
counter := 0 counter := 0
for hash := range approvers.hashes { for hash := range approvers.hashes {
......
...@@ -31,5 +31,5 @@ const ( ...@@ -31,5 +31,5 @@ const (
MARSHALLED_TOTAL_SIZE = DATA_END MARSHALLED_TOTAL_SIZE = DATA_END
BRANCH_NULL_HASH = ternary.Trinary("999999999999999999999999999999999999999999999999999999999999999999999999999999999") BRANCH_NULL_HASH = ternary.Trytes("999999999999999999999999999999999999999999999999999999999999999999999999999999999")
) )
...@@ -8,15 +8,15 @@ import ( ...@@ -8,15 +8,15 @@ import (
) )
type MetaTransaction struct { type MetaTransaction struct {
hash *ternary.Trinary hash *ternary.Trytes
weightMagnitude int weightMagnitude int
shardMarker *ternary.Trinary shardMarker *ternary.Trytes
trunkTransactionHash *ternary.Trinary trunkTransactionHash *ternary.Trytes
branchTransactionHash *ternary.Trinary branchTransactionHash *ternary.Trytes
head *bool head *bool
tail *bool tail *bool
transactionType *ternary.Trinary transactionType *ternary.Trytes
data ternary.Trits data ternary.Trits
modified bool modified bool
...@@ -72,7 +72,7 @@ func (this *MetaTransaction) ReHash() { ...@@ -72,7 +72,7 @@ func (this *MetaTransaction) ReHash() {
} }
// retrieves the hash of the transaction // retrieves the hash of the transaction
func (this *MetaTransaction) GetHash() (result ternary.Trinary) { func (this *MetaTransaction) GetHash() (result ternary.Trytes) {
this.hashMutex.RLock() this.hashMutex.RLock()
if this.hash == nil { if this.hash == nil {
this.hashMutex.RUnlock() this.hashMutex.RUnlock()
...@@ -116,21 +116,21 @@ func (this *MetaTransaction) GetWeightMagnitude() (result int) { ...@@ -116,21 +116,21 @@ func (this *MetaTransaction) GetWeightMagnitude() (result int) {
// hashes the transaction using curl (without locking - internal usage) // hashes the transaction using curl (without locking - internal usage)
func (this *MetaTransaction) parseHashRelatedDetails() { func (this *MetaTransaction) parseHashRelatedDetails() {
hashTrits := <-curl.CURLP81.Hash(this.trits) hashTrits := <-curl.CURLP81.Hash(this.trits)
hashTrinary := hashTrits.ToTrinary() hashTrytes := hashTrits.ToTrytes()
this.hash = &hashTrinary this.hash = &hashTrytes
this.weightMagnitude = hashTrits.TrailingZeroes() this.weightMagnitude = hashTrits.TrailingZeroes()
} }
// getter for the shard marker (supports concurrency) // getter for the shard marker (supports concurrency)
func (this *MetaTransaction) GetShardMarker() (result ternary.Trinary) { func (this *MetaTransaction) GetShardMarker() (result ternary.Trytes) {
this.shardMarkerMutex.RLock() this.shardMarkerMutex.RLock()
if this.shardMarker == nil { if this.shardMarker == nil {
this.shardMarkerMutex.RUnlock() this.shardMarkerMutex.RUnlock()
this.shardMarkerMutex.Lock() this.shardMarkerMutex.Lock()
defer this.shardMarkerMutex.Unlock() defer this.shardMarkerMutex.Unlock()
if this.shardMarker == nil { if this.shardMarker == nil {
shardMarker := this.trits[SHARD_MARKER_OFFSET:SHARD_MARKER_END].ToTrinary() shardMarker := this.trits[SHARD_MARKER_OFFSET:SHARD_MARKER_END].ToTrytes()
this.shardMarker = &shardMarker this.shardMarker = &shardMarker
} }
...@@ -144,7 +144,7 @@ func (this *MetaTransaction) GetShardMarker() (result ternary.Trinary) { ...@@ -144,7 +144,7 @@ func (this *MetaTransaction) GetShardMarker() (result ternary.Trinary) {
} }
// setter for the shard marker (supports concurrency) // setter for the shard marker (supports concurrency)
func (this *MetaTransaction) SetShardMarker(shardMarker ternary.Trinary) bool { func (this *MetaTransaction) SetShardMarker(shardMarker ternary.Trytes) bool {
this.shardMarkerMutex.RLock() this.shardMarkerMutex.RLock()
if this.shardMarker == nil || *this.shardMarker != shardMarker { if this.shardMarker == nil || *this.shardMarker != shardMarker {
this.shardMarkerMutex.RUnlock() this.shardMarkerMutex.RUnlock()
...@@ -170,14 +170,14 @@ func (this *MetaTransaction) SetShardMarker(shardMarker ternary.Trinary) bool { ...@@ -170,14 +170,14 @@ func (this *MetaTransaction) SetShardMarker(shardMarker ternary.Trinary) bool {
} }
// getter for the bundleHash (supports concurrency) // getter for the bundleHash (supports concurrency)
func (this *MetaTransaction) GetTrunkTransactionHash() (result ternary.Trinary) { func (this *MetaTransaction) GetTrunkTransactionHash() (result ternary.Trytes) {
this.trunkTransactionHashMutex.RLock() this.trunkTransactionHashMutex.RLock()
if this.trunkTransactionHash == nil { if this.trunkTransactionHash == nil {
this.trunkTransactionHashMutex.RUnlock() this.trunkTransactionHashMutex.RUnlock()
this.trunkTransactionHashMutex.Lock() this.trunkTransactionHashMutex.Lock()
defer this.trunkTransactionHashMutex.Unlock() defer this.trunkTransactionHashMutex.Unlock()
if this.trunkTransactionHash == nil { if this.trunkTransactionHash == nil {
trunkTransactionHash := this.trits[TRUNK_TRANSACTION_HASH_OFFSET:TRUNK_TRANSACTION_HASH_END].ToTrinary() trunkTransactionHash := this.trits[TRUNK_TRANSACTION_HASH_OFFSET:TRUNK_TRANSACTION_HASH_END].ToTrytes()
this.trunkTransactionHash = &trunkTransactionHash this.trunkTransactionHash = &trunkTransactionHash
} }
...@@ -191,7 +191,7 @@ func (this *MetaTransaction) GetTrunkTransactionHash() (result ternary.Trinary) ...@@ -191,7 +191,7 @@ func (this *MetaTransaction) GetTrunkTransactionHash() (result ternary.Trinary)
} }
// setter for the trunkTransactionHash (supports concurrency) // setter for the trunkTransactionHash (supports concurrency)
func (this *MetaTransaction) SetTrunkTransactionHash(trunkTransactionHash ternary.Trinary) bool { func (this *MetaTransaction) SetTrunkTransactionHash(trunkTransactionHash ternary.Trytes) bool {
this.trunkTransactionHashMutex.RLock() this.trunkTransactionHashMutex.RLock()
if this.trunkTransactionHash == nil || *this.trunkTransactionHash != trunkTransactionHash { if this.trunkTransactionHash == nil || *this.trunkTransactionHash != trunkTransactionHash {
this.trunkTransactionHashMutex.RUnlock() this.trunkTransactionHashMutex.RUnlock()
...@@ -217,14 +217,14 @@ func (this *MetaTransaction) SetTrunkTransactionHash(trunkTransactionHash ternar ...@@ -217,14 +217,14 @@ func (this *MetaTransaction) SetTrunkTransactionHash(trunkTransactionHash ternar
} }
// getter for the bundleHash (supports concurrency) // getter for the bundleHash (supports concurrency)
func (this *MetaTransaction) GetBranchTransactionHash() (result ternary.Trinary) { func (this *MetaTransaction) GetBranchTransactionHash() (result ternary.Trytes) {
this.branchTransactionHashMutex.RLock() this.branchTransactionHashMutex.RLock()
if this.branchTransactionHash == nil { if this.branchTransactionHash == nil {
this.branchTransactionHashMutex.RUnlock() this.branchTransactionHashMutex.RUnlock()
this.branchTransactionHashMutex.Lock() this.branchTransactionHashMutex.Lock()
defer this.branchTransactionHashMutex.Unlock() defer this.branchTransactionHashMutex.Unlock()
if this.branchTransactionHash == nil { if this.branchTransactionHash == nil {
branchTransactionHash := this.trits[BRANCH_TRANSACTION_HASH_OFFSET:BRANCH_TRANSACTION_HASH_END].ToTrinary() branchTransactionHash := this.trits[BRANCH_TRANSACTION_HASH_OFFSET:BRANCH_TRANSACTION_HASH_END].ToTrytes()
this.branchTransactionHash = &branchTransactionHash this.branchTransactionHash = &branchTransactionHash
} }
...@@ -238,7 +238,7 @@ func (this *MetaTransaction) GetBranchTransactionHash() (result ternary.Trinary) ...@@ -238,7 +238,7 @@ func (this *MetaTransaction) GetBranchTransactionHash() (result ternary.Trinary)
} }
// setter for the trunkTransactionHash (supports concurrency) // setter for the trunkTransactionHash (supports concurrency)
func (this *MetaTransaction) SetBranchTransactionHash(branchTransactionHash ternary.Trinary) bool { func (this *MetaTransaction) SetBranchTransactionHash(branchTransactionHash ternary.Trytes) bool {
this.branchTransactionHashMutex.RLock() this.branchTransactionHashMutex.RLock()
if this.branchTransactionHash == nil || *this.branchTransactionHash != branchTransactionHash { if this.branchTransactionHash == nil || *this.branchTransactionHash != branchTransactionHash {
this.branchTransactionHashMutex.RUnlock() this.branchTransactionHashMutex.RUnlock()
...@@ -366,14 +366,14 @@ func (this *MetaTransaction) SetTail(tail bool) bool { ...@@ -366,14 +366,14 @@ func (this *MetaTransaction) SetTail(tail bool) bool {
} }
// getter for the transaction type (supports concurrency) // getter for the transaction type (supports concurrency)
func (this *MetaTransaction) GetTransactionType() (result ternary.Trinary) { func (this *MetaTransaction) GetTransactionType() (result ternary.Trytes) {
this.transactionTypeMutex.RLock() this.transactionTypeMutex.RLock()
if this.transactionType == nil { if this.transactionType == nil {
this.transactionTypeMutex.RUnlock() this.transactionTypeMutex.RUnlock()
this.transactionTypeMutex.Lock() this.transactionTypeMutex.Lock()
defer this.transactionTypeMutex.Unlock() defer this.transactionTypeMutex.Unlock()
if this.transactionType == nil { if this.transactionType == nil {
transactionType := this.trits[TRANSACTION_TYPE_OFFSET:TRANSACTION_TYPE_END].ToTrinary() transactionType := this.trits[TRANSACTION_TYPE_OFFSET:TRANSACTION_TYPE_END].ToTrytes()
this.transactionType = &transactionType this.transactionType = &transactionType
} }
...@@ -387,7 +387,7 @@ func (this *MetaTransaction) GetTransactionType() (result ternary.Trinary) { ...@@ -387,7 +387,7 @@ func (this *MetaTransaction) GetTransactionType() (result ternary.Trinary) {
} }
// setter for the transaction type (supports concurrency) // setter for the transaction type (supports concurrency)
func (this *MetaTransaction) SetTransactionType(transactionType ternary.Trinary) bool { func (this *MetaTransaction) SetTransactionType(transactionType ternary.Trytes) bool {
this.transactionTypeMutex.RLock() this.transactionTypeMutex.RLock()
if this.transactionType == nil || *this.transactionType != transactionType { if this.transactionType == nil || *this.transactionType != transactionType {
this.transactionTypeMutex.RUnlock() this.transactionTypeMutex.RUnlock()
......
...@@ -10,12 +10,12 @@ import ( ...@@ -10,12 +10,12 @@ import (
) )
func TestMetaTransaction_SettersGetters(t *testing.T) { func TestMetaTransaction_SettersGetters(t *testing.T) {
shardMarker := ternary.Trinary("NPHTQORL9XKA") shardMarker := ternary.Trytes("NPHTQORL9XKA")
trunkTransactionHash := ternary.Trinary("99999999999999999999999999999999999999999999999999999999999999999999999999999999A") trunkTransactionHash := ternary.Trytes("99999999999999999999999999999999999999999999999999999999999999999999999999999999A")
branchTransactionHash := ternary.Trinary("99999999999999999999999999999999999999999999999999999999999999999999999999999999B") branchTransactionHash := ternary.Trytes("99999999999999999999999999999999999999999999999999999999999999999999999999999999B")
head := true head := true
tail := true tail := true
transactionType := ternary.Trinary("9999999999999999999999") transactionType := ternary.Trytes("9999999999999999999999")
transaction := New() transaction := New()
transaction.SetShardMarker(shardMarker) transaction.SetShardMarker(shardMarker)
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
// region type definition and constructor ////////////////////////////////////////////////////////////////////////////// // region type definition and constructor //////////////////////////////////////////////////////////////////////////////
type TransactionMetadata struct { type TransactionMetadata struct {
hash ternary.Trinary hash ternary.Trytes
hashMutex sync.RWMutex hashMutex sync.RWMutex
receivedTime time.Time receivedTime time.Time
receivedTimeMutex sync.RWMutex receivedTimeMutex sync.RWMutex
...@@ -27,7 +27,7 @@ type TransactionMetadata struct { ...@@ -27,7 +27,7 @@ type TransactionMetadata struct {
modifiedMutex sync.RWMutex modifiedMutex sync.RWMutex
} }
func New(hash ternary.Trinary) *TransactionMetadata { func New(hash ternary.Trytes) *TransactionMetadata {
return &TransactionMetadata{ return &TransactionMetadata{
hash: hash, hash: hash,
receivedTime: time.Now(), receivedTime: time.Now(),
...@@ -42,14 +42,14 @@ func New(hash ternary.Trinary) *TransactionMetadata { ...@@ -42,14 +42,14 @@ func New(hash ternary.Trinary) *TransactionMetadata {
// region getters and setters ////////////////////////////////////////////////////////////////////////////////////////// // region getters and setters //////////////////////////////////////////////////////////////////////////////////////////
func (metadata *TransactionMetadata) GetHash() ternary.Trinary { func (metadata *TransactionMetadata) GetHash() ternary.Trytes {
metadata.hashMutex.RLock() metadata.hashMutex.RLock()
defer metadata.hashMutex.RUnlock() defer metadata.hashMutex.RUnlock()
return metadata.hash return metadata.hash
} }
func (metadata *TransactionMetadata) SetHash(hash ternary.Trinary) { func (metadata *TransactionMetadata) SetHash(hash ternary.Trytes) {
metadata.hashMutex.RLock() metadata.hashMutex.RLock()
if metadata.hash != hash { if metadata.hash != hash {
metadata.hashMutex.RUnlock() metadata.hashMutex.RUnlock()
...@@ -228,7 +228,7 @@ func (metadata *TransactionMetadata) Unmarshal(data []byte) errors.IdentifiableE ...@@ -228,7 +228,7 @@ func (metadata *TransactionMetadata) Unmarshal(data []byte) errors.IdentifiableE
metadata.finalizedMutex.Lock() metadata.finalizedMutex.Lock()
defer metadata.finalizedMutex.Unlock() defer metadata.finalizedMutex.Unlock()
metadata.hash = ternary.Trinary(typeutils.BytesToString(data[MARSHALED_HASH_START:MARSHALED_HASH_END])) metadata.hash = ternary.Trytes(typeutils.BytesToString(data[MARSHALED_HASH_START:MARSHALED_HASH_END]))
if err := metadata.receivedTime.UnmarshalBinary(data[MARSHALED_RECEIVED_TIME_START:MARSHALED_RECEIVED_TIME_END]); err != nil { if err := metadata.receivedTime.UnmarshalBinary(data[MARSHALED_RECEIVED_TIME_START:MARSHALED_RECEIVED_TIME_END]); err != nil {
return ErrUnmarshalFailed.Derive(err, "could not unmarshal the received time") return ErrUnmarshalFailed.Derive(err, "could not unmarshal the received time")
......
...@@ -10,15 +10,15 @@ import ( ...@@ -10,15 +10,15 @@ import (
type ValueTransaction struct { type ValueTransaction struct {
*meta_transaction.MetaTransaction *meta_transaction.MetaTransaction
address *ternary.Trinary address *ternary.Trytes
addressMutex sync.RWMutex addressMutex sync.RWMutex
value *int64 value *int64
valueMutex sync.RWMutex valueMutex sync.RWMutex
timestamp *uint timestamp *uint
timestampMutex sync.RWMutex timestampMutex sync.RWMutex
nonce *ternary.Trinary nonce *ternary.Trytes
nonceMutex sync.RWMutex nonceMutex sync.RWMutex
signatureMessageFragment *ternary.Trinary signatureMessageFragment *ternary.Trytes
signatureMessageFragmentMutex sync.RWMutex signatureMessageFragmentMutex sync.RWMutex
trits ternary.Trits trits ternary.Trits
...@@ -52,14 +52,14 @@ func FromBytes(bytes []byte) (result *ValueTransaction) { ...@@ -52,14 +52,14 @@ func FromBytes(bytes []byte) (result *ValueTransaction) {
} }
// getter for the address (supports concurrency) // getter for the address (supports concurrency)
func (this *ValueTransaction) GetAddress() (result ternary.Trinary) { func (this *ValueTransaction) GetAddress() (result ternary.Trytes) {
this.addressMutex.RLock() this.addressMutex.RLock()
if this.address == nil { if this.address == nil {
this.addressMutex.RUnlock() this.addressMutex.RUnlock()
this.addressMutex.Lock() this.addressMutex.Lock()
defer this.addressMutex.Unlock() defer this.addressMutex.Unlock()
if this.address == nil { if this.address == nil {
address := this.trits[ADDRESS_OFFSET:ADDRESS_END].ToTrinary() address := this.trits[ADDRESS_OFFSET:ADDRESS_END].ToTrytes()
this.address = &address this.address = &address
} }
...@@ -73,7 +73,7 @@ func (this *ValueTransaction) GetAddress() (result ternary.Trinary) { ...@@ -73,7 +73,7 @@ func (this *ValueTransaction) GetAddress() (result ternary.Trinary) {
} }
// setter for the address (supports concurrency) // setter for the address (supports concurrency)
func (this *ValueTransaction) SetAddress(address ternary.Trinary) bool { func (this *ValueTransaction) SetAddress(address ternary.Trytes) bool {
this.addressMutex.RLock() this.addressMutex.RLock()
if this.address == nil || *this.address != address { if this.address == nil || *this.address != address {
this.addressMutex.RUnlock() this.addressMutex.RUnlock()
...@@ -193,14 +193,14 @@ func (this *ValueTransaction) SetTimestamp(timestamp uint) bool { ...@@ -193,14 +193,14 @@ func (this *ValueTransaction) SetTimestamp(timestamp uint) bool {
} }
// getter for the nonce (supports concurrency) // getter for the nonce (supports concurrency)
func (this *ValueTransaction) GetNonce() (result ternary.Trinary) { func (this *ValueTransaction) GetNonce() (result ternary.Trytes) {
this.nonceMutex.RLock() this.nonceMutex.RLock()
if this.nonce == nil { if this.nonce == nil {
this.nonceMutex.RUnlock() this.nonceMutex.RUnlock()
this.nonceMutex.Lock() this.nonceMutex.Lock()
defer this.nonceMutex.Unlock() defer this.nonceMutex.Unlock()
if this.nonce == nil { if this.nonce == nil {
nonce := this.trits[NONCE_OFFSET:NONCE_END].ToTrinary() nonce := this.trits[NONCE_OFFSET:NONCE_END].ToTrytes()
this.nonce = &nonce this.nonce = &nonce
} }
...@@ -214,7 +214,7 @@ func (this *ValueTransaction) GetNonce() (result ternary.Trinary) { ...@@ -214,7 +214,7 @@ func (this *ValueTransaction) GetNonce() (result ternary.Trinary) {
} }
// setter for the nonce (supports concurrency) // setter for the nonce (supports concurrency)
func (this *ValueTransaction) SetNonce(nonce ternary.Trinary) bool { func (this *ValueTransaction) SetNonce(nonce ternary.Trytes) bool {
this.nonceMutex.RLock() this.nonceMutex.RLock()
if this.nonce == nil || *this.nonce != nonce { if this.nonce == nil || *this.nonce != nonce {
this.nonceMutex.RUnlock() this.nonceMutex.RUnlock()
...@@ -240,14 +240,14 @@ func (this *ValueTransaction) SetNonce(nonce ternary.Trinary) bool { ...@@ -240,14 +240,14 @@ func (this *ValueTransaction) SetNonce(nonce ternary.Trinary) bool {
} }
// getter for the signatureMessageFragmetn (supports concurrency) // getter for the signatureMessageFragmetn (supports concurrency)
func (this *ValueTransaction) GetSignatureMessageFragment() (result ternary.Trinary) { func (this *ValueTransaction) GetSignatureMessageFragment() (result ternary.Trytes) {
this.signatureMessageFragmentMutex.RLock() this.signatureMessageFragmentMutex.RLock()
if this.signatureMessageFragment == nil { if this.signatureMessageFragment == nil {
this.signatureMessageFragmentMutex.RUnlock() this.signatureMessageFragmentMutex.RUnlock()
this.signatureMessageFragmentMutex.Lock() this.signatureMessageFragmentMutex.Lock()
defer this.signatureMessageFragmentMutex.Unlock() defer this.signatureMessageFragmentMutex.Unlock()
if this.signatureMessageFragment == nil { if this.signatureMessageFragment == nil {
signatureMessageFragment := this.trits[SIGNATURE_MESSAGE_FRAGMENT_OFFSET:SIGNATURE_MESSAGE_FRAGMENT_END].ToTrinary() signatureMessageFragment := this.trits[SIGNATURE_MESSAGE_FRAGMENT_OFFSET:SIGNATURE_MESSAGE_FRAGMENT_END].ToTrytes()
this.signatureMessageFragment = &signatureMessageFragment this.signatureMessageFragment = &signatureMessageFragment
} }
...@@ -261,7 +261,7 @@ func (this *ValueTransaction) GetSignatureMessageFragment() (result ternary.Trin ...@@ -261,7 +261,7 @@ func (this *ValueTransaction) GetSignatureMessageFragment() (result ternary.Trin
} }
// setter for the nonce (supports concurrency) // setter for the nonce (supports concurrency)
func (this *ValueTransaction) SetSignatureMessageFragment(signatureMessageFragment ternary.Trinary) bool { func (this *ValueTransaction) SetSignatureMessageFragment(signatureMessageFragment ternary.Trytes) bool {
this.signatureMessageFragmentMutex.RLock() this.signatureMessageFragmentMutex.RLock()
if this.signatureMessageFragment == nil || *this.signatureMessageFragment != signatureMessageFragment { if this.signatureMessageFragment == nil || *this.signatureMessageFragment != signatureMessageFragment {
this.signatureMessageFragmentMutex.RUnlock() this.signatureMessageFragmentMutex.RUnlock()
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
) )
func TestValueTransaction_SettersGetters(t *testing.T) { func TestValueTransaction_SettersGetters(t *testing.T) {
address := ternary.Trinary("A9999999999999999999999999999999999999999999999999999999999999999999999999999999F") address := ternary.Trytes("A9999999999999999999999999999999999999999999999999999999999999999999999999999999F")
transaction := New() transaction := New()
transaction.SetAddress(address) transaction.SetAddress(address)
......
...@@ -6,8 +6,8 @@ type BCTrit struct { ...@@ -6,8 +6,8 @@ type BCTrit struct {
Hi uint Hi uint
} }
// a Binary Coded Trinary consists out of many Binary Coded Trits // a Binary Coded Trytes consists out of many Binary Coded Trits
type BCTrinary struct { type BCTrits struct {
Lo []uint Lo []uint
Hi []uint Hi []uint
} }
package ternary package ternary
type BCTernaryDemultiplexer struct { type BCTernaryDemultiplexer struct {
bcTrinary BCTrinary bcTrits BCTrits
} }
func NewBCTernaryDemultiplexer(bcTrinary BCTrinary) *BCTernaryDemultiplexer { func NewBCTernaryDemultiplexer(bcTrits BCTrits) *BCTernaryDemultiplexer {
this := &BCTernaryDemultiplexer{bcTrinary: bcTrinary} this := &BCTernaryDemultiplexer{bcTrits: bcTrits}
return this return this
} }
func (this *BCTernaryDemultiplexer) Get(index int) Trits { func (this *BCTernaryDemultiplexer) Get(index int) Trits {
length := len(this.bcTrinary.Lo) length := len(this.bcTrits.Lo)
result := make(Trits, length) result := make(Trits, length)
for i := 0; i < length; i++ { for i := 0; i < length; i++ {
low := (this.bcTrinary.Lo[i] >> uint(index)) & 1 low := (this.bcTrits.Lo[i] >> uint(index)) & 1
hi := (this.bcTrinary.Hi[i] >> uint(index)) & 1 hi := (this.bcTrits.Hi[i] >> uint(index)) & 1
switch true { switch true {
case low == 1 && hi == 0: case low == 1 && hi == 0:
......
...@@ -15,8 +15,8 @@ func NewBCTernaryMultiplexer() *BCTernaryMultiplexer { ...@@ -15,8 +15,8 @@ func NewBCTernaryMultiplexer() *BCTernaryMultiplexer {
return this return this
} }
func (this *BCTernaryMultiplexer) Add(trinary Trits) int { func (this *BCTernaryMultiplexer) Add(trits Trits) int {
this.trinaries = append(this.trinaries, trinary) this.trinaries = append(this.trinaries, trits)
return len(this.trinaries) - 1 return len(this.trinaries) - 1
} }
...@@ -25,11 +25,11 @@ func (this *BCTernaryMultiplexer) Get(index int) Trits { ...@@ -25,11 +25,11 @@ func (this *BCTernaryMultiplexer) Get(index int) Trits {
return this.trinaries[index] return this.trinaries[index]
} }
func (this *BCTernaryMultiplexer) Extract() (BCTrinary, error) { func (this *BCTernaryMultiplexer) Extract() (BCTrits, error) {
trinariesCount := len(this.trinaries) trinariesCount := len(this.trinaries)
tritsCount := len(this.trinaries[0]) tritsCount := len(this.trinaries[0])
result := BCTrinary{ result := BCTrits{
Lo: make([]uint, tritsCount), Lo: make([]uint, tritsCount),
Hi: make([]uint, tritsCount), Hi: make([]uint, tritsCount),
} }
...@@ -50,7 +50,7 @@ func (this *BCTernaryMultiplexer) Extract() (BCTrinary, error) { ...@@ -50,7 +50,7 @@ func (this *BCTernaryMultiplexer) Extract() (BCTrinary, error) {
bcTrit.Hi |= 1 << uint(j) bcTrit.Hi |= 1 << uint(j)
default: default:
return result, errors.New("Invalid trit #" + strconv.Itoa(i) + " in trinary #" + strconv.Itoa(j)) return result, errors.New("Invalid trit #" + strconv.Itoa(i) + " in trits #" + strconv.Itoa(j))
} }
} }
......
...@@ -11,19 +11,19 @@ type Trit = int8 ...@@ -11,19 +11,19 @@ type Trit = int8
// Trits consists out of many Trits // Trits consists out of many Trits
type Trits []Trit type Trits []Trit
// Trinary is a string representation of the Trits // Trytes is a string representation of the Trits
type Trinary string type Trytes string
// simply changes the type of this Trinary to a byte array without copying any data // simply changes the type of this Trytes to a byte array without copying any data
func (trinary Trinary) CastToBytes() []byte { func (trytes Trytes) CastToBytes() []byte {
hdr := (*reflect.StringHeader)(unsafe.Pointer(&trinary)) hdr := (*reflect.StringHeader)(unsafe.Pointer(&trytes))
return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{Data: hdr.Data, Len: hdr.Len, Cap: hdr.Len})) return *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{Data: hdr.Data, Len: hdr.Len, Cap: hdr.Len}))
} }
func (trinary Trinary) ToTrits() Trits { func (trytes Trytes) ToTrits() Trits {
trits := make(Trits, 0, len(trinary)*NUMBER_OF_TRITS_IN_A_TRYTE) trits := make(Trits, 0, len(trytes)*NUMBER_OF_TRITS_IN_A_TRYTE)
for _, char := range trinary { for _, char := range trytes {
trits = append(trits, TRYTES_TO_TRITS_MAP[char]...) trits = append(trits, TRYTES_TO_TRITS_MAP[char]...)
} }
...@@ -96,6 +96,6 @@ func (this Trits) ToString() string { ...@@ -96,6 +96,6 @@ func (this Trits) ToString() string {
return TritsToString(this, 0, len(this)) return TritsToString(this, 0, len(this))
} }
func (this Trits) ToTrinary() Trinary { func (this Trits) ToTrytes() Trytes {
return Trinary(TritsToString(this, 0, len(this))) return Trytes(TritsToString(this, 0, len(this)))
} }
...@@ -12,7 +12,8 @@ import ( ...@@ -12,7 +12,8 @@ import (
// region global public api //////////////////////////////////////////////////////////////////////////////////////////// // region global public api ////////////////////////////////////////////////////////////////////////////////////////////
func GetApprovers(transactionHash ternary.Trinary, computeIfAbsent ...func(ternary.Trinary) *approvers.Approvers) (result *approvers.Approvers, err errors.IdentifiableError) { // GetApprovers retrieves approvers from the database.
func GetApprovers(transactionHash ternary.Trytes, computeIfAbsent ...func(ternary.Trytes) *approvers.Approvers) (result *approvers.Approvers, err errors.IdentifiableError) {
if cacheResult := approversCache.ComputeIfAbsent(transactionHash, func() interface{} { if cacheResult := approversCache.ComputeIfAbsent(transactionHash, func() interface{} {
if dbApprovers, dbErr := getApproversFromDatabase(transactionHash); dbErr != nil { if dbApprovers, dbErr := getApproversFromDatabase(transactionHash); dbErr != nil {
err = dbErr err = dbErr
...@@ -34,7 +35,7 @@ func GetApprovers(transactionHash ternary.Trinary, computeIfAbsent ...func(terna ...@@ -34,7 +35,7 @@ func GetApprovers(transactionHash ternary.Trinary, computeIfAbsent ...func(terna
return return
} }
func ContainsApprovers(transactionHash ternary.Trinary) (result bool, err errors.IdentifiableError) { func ContainsApprovers(transactionHash ternary.Trytes) (result bool, err errors.IdentifiableError) {
if approversCache.Contains(transactionHash) { if approversCache.Contains(transactionHash) {
result = true result = true
} else { } else {
...@@ -94,14 +95,14 @@ func storeApproversInDatabase(approvers *approvers.Approvers) errors.Identifiabl ...@@ -94,14 +95,14 @@ func storeApproversInDatabase(approvers *approvers.Approvers) errors.Identifiabl
return nil return nil
} }
func getApproversFromDatabase(transactionHash ternary.Trinary) (*approvers.Approvers, errors.IdentifiableError) { func getApproversFromDatabase(transactionHash ternary.Trytes) (*approvers.Approvers, errors.IdentifiableError) {
approversData, err := approversDatabase.Get(transactionHash.CastToBytes()) approversData, err := approversDatabase.Get(transactionHash.CastToBytes())
if err != nil { if err != nil {
if err == badger.ErrKeyNotFound { if err == badger.ErrKeyNotFound {
return nil, nil return nil, nil
} else {
return nil, ErrDatabaseError.Derive(err, "failed to retrieve approvers")
} }
return nil, ErrDatabaseError.Derive(err, "failed to retrieve approvers")
} }
var result approvers.Approvers var result approvers.Approvers
...@@ -112,7 +113,7 @@ func getApproversFromDatabase(transactionHash ternary.Trinary) (*approvers.Appro ...@@ -112,7 +113,7 @@ func getApproversFromDatabase(transactionHash ternary.Trinary) (*approvers.Appro
return &result, nil return &result, nil
} }
func databaseContainsApprovers(transactionHash ternary.Trinary) (bool, errors.IdentifiableError) { func databaseContainsApprovers(transactionHash ternary.Trytes) (bool, errors.IdentifiableError) {
if contains, err := approversDatabase.Contains(transactionHash.CastToBytes()); err != nil { if contains, err := approversDatabase.Contains(transactionHash.CastToBytes()); err != nil {
return false, ErrDatabaseError.Derive(err, "failed to check if the approvers exists") return false, ErrDatabaseError.Derive(err, "failed to check if the approvers exists")
} else { } else {
......
...@@ -114,7 +114,7 @@ func IsSolid(transaction *value_transaction.ValueTransaction) (bool, errors.Iden ...@@ -114,7 +114,7 @@ func IsSolid(transaction *value_transaction.ValueTransaction) (bool, errors.Iden
return false, nil return false, nil
} }
func propagateSolidity(transactionHash ternary.Trinary) errors.IdentifiableError { func propagateSolidity(transactionHash ternary.Trytes) errors.IdentifiableError {
if approvers, err := GetApprovers(transactionHash, approvers.New); err != nil { if approvers, err := GetApprovers(transactionHash, approvers.New); err != nil {
return err return err
} else { } else {
...@@ -138,7 +138,7 @@ func propagateSolidity(transactionHash ternary.Trinary) errors.IdentifiableError ...@@ -138,7 +138,7 @@ func propagateSolidity(transactionHash ternary.Trinary) errors.IdentifiableError
func processMetaTransaction(plugin *node.Plugin, metaTransaction *meta_transaction.MetaTransaction) { func processMetaTransaction(plugin *node.Plugin, metaTransaction *meta_transaction.MetaTransaction) {
var newTransaction bool var newTransaction bool
if tx, err := GetTransaction(metaTransaction.GetHash(), func(transactionHash ternary.Trinary) *value_transaction.ValueTransaction { if tx, err := GetTransaction(metaTransaction.GetHash(), func(transactionHash ternary.Trytes) *value_transaction.ValueTransaction {
newTransaction = true newTransaction = true
return value_transaction.FromMetaTransaction(metaTransaction) return value_transaction.FromMetaTransaction(metaTransaction)
......
...@@ -19,7 +19,7 @@ func TestSolidifier(t *testing.T) { ...@@ -19,7 +19,7 @@ func TestSolidifier(t *testing.T) {
// create transactions and chain them together // create transactions and chain them together
transaction1 := value_transaction.New() transaction1 := value_transaction.New()
transaction1.SetNonce(ternary.Trinary("99999999999999999999999999A")) transaction1.SetNonce(ternary.Trytes("99999999999999999999999999A"))
transaction2 := value_transaction.New() transaction2 := value_transaction.New()
transaction2.SetBranchTransactionHash(transaction1.GetHash()) transaction2.SetBranchTransactionHash(transaction1.GetHash())
transaction3 := value_transaction.New() transaction3 := value_transaction.New()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment