diff --git a/packages/model/value_transaction/value_transaction.go b/packages/model/value_transaction/value_transaction.go index 398e90c0f1305648baa41b39e124a80a61e3711d..25e98607332e486747615763e4629066aeebda4d 100644 --- a/packages/model/value_transaction/value_transaction.go +++ b/packages/model/value_transaction/value_transaction.go @@ -206,8 +206,8 @@ func (this *ValueTransaction) GetBundleEssence() (result trinary.Trits) { copy(result[0:], this.trits[ADDRESS_OFFSET:VALUE_END]) - if this.GetValue() < 0 { - copy(result[:VALUE_END], this.trits[SIGNATURE_MESSAGE_FRAGMENT_OFFSET:SIGNATURE_MESSAGE_FRAGMENT_END]) + if this.GetValue() >= 0 { + copy(result[VALUE_END:], this.trits[SIGNATURE_MESSAGE_FRAGMENT_OFFSET:SIGNATURE_MESSAGE_FRAGMENT_END]) } this.signatureMessageFragmentMutex.RUnlock() diff --git a/plugins/bundleprocessor/bundleprocessor.go b/plugins/bundleprocessor/bundleprocessor.go index 13bef81e8764ccf3b89bfe605f4b1d627b28cfc9..30c8b6d58df353ee39235320bcb3b013bd39f669 100644 --- a/plugins/bundleprocessor/bundleprocessor.go +++ b/plugins/bundleprocessor/bundleprocessor.go @@ -1,6 +1,7 @@ package bundleprocessor import ( + "github.com/iotadevelopment/go/packages/ternary" "github.com/iotaledger/goshimmer/packages/errors" "github.com/iotaledger/goshimmer/packages/model/bundle" "github.com/iotaledger/goshimmer/packages/model/transactionmetadata" @@ -52,6 +53,15 @@ func ProcessSolidBundleHead(headTransaction *value_transaction.ValueTransaction) if currentTransaction.IsTail() { newBundle.SetTransactionHashes(mapTransactionsToTransactionHashes(bundleTransactions)) + if newBundle.IsValueBundle() { + var concatenatedBundleEssences = make(ternary.Trits, len(bundleTransactions)*value_transaction.BUNDLE_ESSENCE_SIZE) + for i, bundleTransaction := range bundleTransactions { + copy(concatenatedBundleEssences[value_transaction.BUNDLE_ESSENCE_SIZE*i:value_transaction.BUNDLE_ESSENCE_SIZE*(i+1)], bundleTransaction.GetBundleEssence()) + } + + // calc + set bundle hash + } + Events.BundleSolid.Trigger(newBundle, bundleTransactions) return newBundle, nil