core: Optimize writing of block headers to avoid unncessay array copies (#5908)

This commit is contained in:
Chris Stewart 2025-02-06 14:44:38 -06:00 committed by GitHub
parent 58d9021963
commit 4547052111
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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))
} }
} }