File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -293,6 +293,12 @@ export class AggregateTransaction extends Transaction {
293293
294294 // calculate each inner transaction's size
295295 let byteTransactions = 0 ;
296+ this . innerTransactions . forEach ( ( transaction ) => {
297+ const transactionByte = transaction . toAggregateTransactionBytes ( ) ;
298+ const innerTransactionPadding = new Uint8Array ( this . getInnerTransactionPaddingSize ( transactionByte . length , 8 ) ) ;
299+ const paddedTransactionByte = GeneratorUtils . concatTypedArrays ( transactionByte , innerTransactionPadding ) ;
300+ byteTransactions += paddedTransactionByte . length ;
301+ } ) ;
296302 this . innerTransactions . map ( ( transaction ) => {
297303 byteTransactions += ( transaction . size - 80 ) ;
298304 } ) ;
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ export abstract class Transaction {
124124 const generationHashBytes = Array . from ( Convert . hexToUint8 ( generationHash ) ) ;
125125 const signSchema = SHA3Hasher . resolveSignSchema ( account . networkType ) ;
126126 const byteBuffer = Array . from ( this . generateBytes ( ) ) ;
127- const signingBytes = generationHashBytes . concat ( byteBuffer . slice ( 4 + 64 + 32 + 8 ) ) ;
127+ const signingBytes = this . getSigningByte ( generationHashBytes ) ;
128128 const keyPairEncoded = KeyPair . createKeyPairFromPrivateKeyString ( account . privateKey , signSchema ) ;
129129 const signature = Array . from ( KeyPair . sign ( account , new Uint8Array ( signingBytes ) , signSchema ) ) ;
130130 const signedTransactionBuffer = byteBuffer
@@ -143,6 +143,21 @@ export abstract class Transaction {
143143 this . networkType ) ;
144144 }
145145
146+ /**
147+ * @internal
148+ * Generate signing bytes
149+ * @param generationHashByte GenerationHashBuffer
150+ */
151+ private getSigningByte ( generationHashByte : number [ ] ) {
152+ const byteBuffer = Array . from ( this . generateBytes ( ) ) ;
153+ const byteBufferWithoutHeader = byteBuffer . slice ( 4 + 64 + 32 + 8 ) ;
154+ if ( this . type === TransactionType . AGGREGATE_BONDED || this . type === TransactionType . AGGREGATE_COMPLETE ) {
155+ return generationHashByte . concat ( byteBufferWithoutHeader . slice ( 0 , 52 ) ) ;
156+ } else {
157+ return generationHashByte . concat ( byteBufferWithoutHeader ) ;
158+ }
159+ }
160+
146161 /**
147162 * Converts the transaction into AggregateTransaction compatible
148163 * @returns {Array.<*> } AggregateTransaction bytes
You can’t perform that action at this time.
0 commit comments