2023-03-17 09:01:52 +00:00
|
|
|
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"
|
2023-05-12 06:55:01 +00:00
|
|
|
"git.gammaspectra.live/P2Pool/sha3"
|
2023-03-17 09:01:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type NilDerivationCache struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *NilDerivationCache) Clear() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-05-12 06:55:01 +00:00
|
|
|
func (d *NilDerivationCache) GetEphemeralPublicKey(a *address.PackedAddress, _ crypto.PrivateKeySlice, txKeyScalar *crypto.PrivateKeyScalar, outputIndex uint64, hasher *sha3.HasherState) (crypto.PublicKeyBytes, uint8) {
|
2023-05-23 08:25:10 +00:00
|
|
|
ephemeralPubKey, viewTag := address.GetEphemeralPublicKeyAndViewTagNoAllocate(a.SpendPublicKey().AsPoint().Point(), address.GetDerivationNoAllocate(a.ViewPublicKey().AsPoint().Point(), txKeyScalar.Scalar()), txKeyScalar.Scalar(), outputIndex, hasher)
|
2023-03-17 09:01:52 +00:00
|
|
|
|
|
|
|
return ephemeralPubKey.AsBytes(), viewTag
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *NilDerivationCache) GetDeterministicTransactionKey(seed types.Hash, prevId types.Hash) *crypto.KeyPair {
|
|
|
|
return crypto.NewKeyPairFromPrivate(address.GetDeterministicTransactionPrivateKey(seed, prevId))
|
|
|
|
}
|