mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
pre-alloc uin256 for chainID derive (#141)
This commit is contained in:
parent
b50cb37fa8
commit
ce3a3dcfeb
@ -44,7 +44,8 @@ type TxParseContext struct {
|
|||||||
keccak2 hash.Hash
|
keccak2 hash.Hash
|
||||||
chainId, r, s, v uint256.Int // Signature values
|
chainId, r, s, v uint256.Int // Signature values
|
||||||
chainIDMul uint256.Int
|
chainIDMul uint256.Int
|
||||||
buf [65]byte // buffer needs to be enough for hashes (32 bytes) and for public key (65 bytes)
|
deriveChainID uint256.Int // pre-allocated variable to calculate Sub(&ctx.v, &ctx.chainIDMul)
|
||||||
|
buf [65]byte // buffer needs to be enough for hashes (32 bytes) and for public key (65 bytes)
|
||||||
sighash [32]byte
|
sighash [32]byte
|
||||||
sig [65]byte
|
sig [65]byte
|
||||||
withSender bool
|
withSender bool
|
||||||
@ -322,8 +323,8 @@ func (ctx *TxParseContext) ParseTransaction(payload []byte, pos int, slot *TxSlo
|
|||||||
sigHashLen += 2 // For two extra zeros
|
sigHashLen += 2 // For two extra zeros
|
||||||
|
|
||||||
//vByte = byte(1 - (ctx.v.Uint64() & 1))
|
//vByte = byte(1 - (ctx.v.Uint64() & 1))
|
||||||
v := uint256.NewInt(0).Sub(&ctx.v, &ctx.chainIDMul)
|
ctx.deriveChainID.Sub(&ctx.v, &ctx.chainIDMul)
|
||||||
vByte = v.Sub(v, u256.N8).Bytes()[0] - 27
|
vByte = ctx.deriveChainID.Sub(&ctx.deriveChainID, u256.N8).Bytes()[0] - 27
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var v uint64
|
var v uint64
|
||||||
|
Loading…
Reference in New Issue
Block a user