question: private int guessTransactionsLength ( ) { if ( transactionBytesValid ) return bytes . length - HEADER_SIZE ; if ( transactions == null ) return 0 ; int len = VarInt . sizeOf ( transactions . size ( ) ) ; for ( Transaction tx : transactions ) { len += tx . length == UNKNOWN_LENGTH ? 255 : tx . length ; } return len ; }
target:  Provides a reasonable guess at the byte length of the transactions part of the block. The returned value will be accurate in 99% of cases and in those cases where not will probably slightly oversize. This is used to preallocate the underlying byte array for a ByteArrayOutputStream.  If the size is under the real value the only penalty is resizing of the underlying byte array.