mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Remove .map() and use .foreach() with buffer in CryptoBytesUtil.toByteVector() (#4454)
This commit is contained in:
parent
ae0962d7ed
commit
2b60bbb1c3
@ -36,7 +36,7 @@ class ScanBitcoind()(implicit
|
||||
bitcoind <- bitcoindF
|
||||
endHeight <- endHeightF
|
||||
//_ <- countWitV1MempoolTxs(bitcoind)
|
||||
_ <- countTaprootTxsInBlocks(endHeight, 10000, bitcoind)
|
||||
_ <- countTaprootTxsInBlocks(endHeight, 250000, bitcoind)
|
||||
} yield ()
|
||||
f.failed.foreach(err =>
|
||||
logger.error(s"Failed to count witness v1 mempool txs", err))
|
||||
|
@ -2,7 +2,7 @@ package org.bitcoins.crypto
|
||||
|
||||
import scodec.bits.{BitVector, ByteVector}
|
||||
|
||||
import scala.math.BigInt
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
/** Created by chris on 2/26/16.
|
||||
*/
|
||||
@ -97,7 +97,11 @@ trait CryptoBytesUtil {
|
||||
|
||||
@inline
|
||||
final def toByteVector[T <: NetworkElement](h: Seq[T]): ByteVector = {
|
||||
ByteVector.concat(h.map(_.bytes))
|
||||
val outputStream = new ByteArrayOutputStream()
|
||||
h.foreach { ne =>
|
||||
outputStream.write(ne.bytes.toArray)
|
||||
}
|
||||
ByteVector(outputStream.toByteArray)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user