mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-23 14:50:42 +01:00
core: Optimize writing of block headers to avoid unncessay array copies (#5908)
This commit is contained in:
parent
58d9021963
commit
4547052111
2 changed files with 2 additions and 2 deletions
|
@ -266,7 +266,7 @@ object P2SHScriptSignature extends ScriptFactory[P2SHScriptSignature] {
|
||||||
/** Detects if the given script token is a redeem script */
|
/** Detects if the given script token is a redeem script */
|
||||||
def isRedeemScript(token: ScriptToken): Boolean = {
|
def isRedeemScript(token: ScriptToken): Boolean = {
|
||||||
token match {
|
token match {
|
||||||
case _: ScriptNumberOperation | _: ScriptOperation | _: ScriptNumber =>
|
case _: ScriptNumberOperation | _: ScriptOperation =>
|
||||||
// more cheap checks, we can't have a redeemScript
|
// more cheap checks, we can't have a redeemScript
|
||||||
// if the token is OP_0/OP_1/OP_CHECKSIG etc
|
// if the token is OP_0/OP_1/OP_CHECKSIG etc
|
||||||
false
|
false
|
||||||
|
|
|
@ -46,7 +46,7 @@ sealed abstract class RawBlockHeaderSerializer
|
||||||
val nBits = blockHeader.nBits.bytes.reverse
|
val nBits = blockHeader.nBits.bytes.reverse
|
||||||
val nonce = blockHeader.nonce.bytes.reverse
|
val nonce = blockHeader.nonce.bytes.reverse
|
||||||
|
|
||||||
version ++ prevHash ++ merkleRoot ++ time ++ nBits ++ nonce
|
ByteVector.concat(Vector(version, prevHash, merkleRoot, time, nBits, nonce))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue