git.gammaspectra.live/P2Pool/consensus@v0.0.0-20240403173234-a039820b20c9/p2pool/sidechain/nilcache.go (about) 1 package sidechain 2 3 import ( 4 "git.gammaspectra.live/P2Pool/consensus/monero/address" 5 "git.gammaspectra.live/P2Pool/consensus/monero/crypto" 6 "git.gammaspectra.live/P2Pool/consensus/types" 7 "git.gammaspectra.live/P2Pool/sha3" 8 ) 9 10 type NilDerivationCache struct { 11 } 12 13 func (d *NilDerivationCache) Clear() { 14 15 } 16 17 func (d *NilDerivationCache) GetEphemeralPublicKey(a *address.PackedAddress, _ crypto.PrivateKeySlice, txKeyScalar *crypto.PrivateKeyScalar, outputIndex uint64, hasher *sha3.HasherState) (crypto.PublicKeyBytes, uint8) { 18 ephemeralPubKey, viewTag := address.GetEphemeralPublicKeyAndViewTagNoAllocate(a.SpendPublicKey().AsPoint().Point(), address.GetDerivationNoAllocate(a.ViewPublicKey().AsPoint().Point(), txKeyScalar.Scalar()), txKeyScalar.Scalar(), outputIndex, hasher) 19 20 return ephemeralPubKey.AsBytes(), viewTag 21 } 22 23 func (d *NilDerivationCache) GetDeterministicTransactionKey(seed types.Hash, prevId types.Hash) *crypto.KeyPair { 24 return crypto.NewKeyPairFromPrivate(address.GetDeterministicTransactionPrivateKey(seed, prevId)) 25 }