Documentation ¶
Overview ¶
Package ppcutil provides a simple LRU cache. It is based on the LRU implementation in groupcache: https://github.com/golang/groupcache/tree/master/lru
Index ¶
- func BlockUnixTime(block *btcutil.Block) int64
- func DifficultyToTarget(diff float64) (target *big.Int)
- func GetNextTargetRequired(params btcnet.Params, db database.Db, last *btcutil.Block, proofOfStake bool) (compact uint32)
- func IsBlockProofOfStake(block *btcutil.Block) bool
- func IsMsgBlockProofOfStake(msg *btcwire.MsgBlock) bool
- func TargetToDifficulty(bits uint32) (diff float64)
- type CBlkIdx
- type Cache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockUnixTime ¶
BlockUnixTime gets block timestamp in unix time
func DifficultyToTarget ¶
func GetNextTargetRequired ¶
func GetNextTargetRequired(params btcnet.Params, db database.Db, last *btcutil.Block, proofOfStake bool) (compact uint32)
GetNextTargetRequired TODO(kac-) golint https://github.com/ppcoin/ppcoin/blob/v0.4.0ppc/src/main.cpp#L902
func IsBlockProofOfStake ¶
IsBlockProofOfStake indicates if block is of proof of stake type
func IsMsgBlockProofOfStake ¶
IsMsgBlockProofOfStake checks if MsgBlock is of proof of stake type https://github.com/ppcoin/ppcoin/blob/v0.4.0ppc/src/main.h#L962 ppc: two types of block: proof-of-work or proof-of-stake
func TargetToDifficulty ¶
Types ¶
type CBlkIdx ¶
type CBlkIdx struct { Prev *CBlkIdx Next *CBlkIdx Height uint32 Mint uint64 Supply uint64 GeneratedModifier bool EntropyBit bool ProofOfStake bool StakeModifier []byte StakeModifierChecksum []byte HashProofOfStake []byte PrevOutHash []byte PrevOutN uint32 StakeTime uint32 HashMerkleRoot []byte BlockHash []byte BlockTrust []byte ChainTrust []byte }
CBlkIdx TODO(kac-) golint
func ReadCBlockIndex ¶
ReadCBlockIndex TODO(kac-) golint
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a thread-safe fixed size LRU cache.
func (*Cache) Remove ¶
func (c *Cache) Remove(key interface{})
Remove removes the provided key from the cache.
func (*Cache) RemoveOldest ¶
func (c *Cache) RemoveOldest()
RemoveOldest removes the oldest item from the cache.