consensus/p2pool/sidechain/nilcache.go
DataHoarder 951b1105ff
All checks were successful
continuous-integration/drone/push Build is passing
Speed improvements on partial crypto derivation
2023-05-23 10:25:10 +02:00

26 lines
1 KiB
Go

package sidechain
import (
"git.gammaspectra.live/P2Pool/p2pool-observer/monero/address"
"git.gammaspectra.live/P2Pool/p2pool-observer/monero/crypto"
"git.gammaspectra.live/P2Pool/p2pool-observer/types"
"git.gammaspectra.live/P2Pool/sha3"
)
type NilDerivationCache struct {
}
func (d *NilDerivationCache) Clear() {
}
func (d *NilDerivationCache) GetEphemeralPublicKey(a *address.PackedAddress, _ crypto.PrivateKeySlice, txKeyScalar *crypto.PrivateKeyScalar, outputIndex uint64, hasher *sha3.HasherState) (crypto.PublicKeyBytes, uint8) {
ephemeralPubKey, viewTag := address.GetEphemeralPublicKeyAndViewTagNoAllocate(a.SpendPublicKey().AsPoint().Point(), address.GetDerivationNoAllocate(a.ViewPublicKey().AsPoint().Point(), txKeyScalar.Scalar()), txKeyScalar.Scalar(), outputIndex, hasher)
return ephemeralPubKey.AsBytes(), viewTag
}
func (d *NilDerivationCache) GetDeterministicTransactionKey(seed types.Hash, prevId types.Hash) *crypto.KeyPair {
return crypto.NewKeyPairFromPrivate(address.GetDeterministicTransactionPrivateKey(seed, prevId))
}