Versions in this module Expand all Collapse all v0 v0.9.3-Beta Dec 19, 2017 v0.9.0 Oct 29, 2017 Changes in this version + const CheckpointConfirmations + const MaxCoinbaseScriptLen + const MaxSigOpsPerBlock + const MaxTimeOffsetSeconds + const MempoolHeight + const MinCoinbaseScriptLen + const ViewpointCurrentRegular + const ViewpointCurrentStake + const ViewpointPrevRegular + var SimNetParams = &chaincfg.Params + func BigToCompact(n *big.Int) uint32 + func BlockOneCoinbasePaysTokens(tx *hcashutil.Tx, params *chaincfg.Params) error + func BuildMerkleTreeStore(transactions []*hcashutil.Tx, compressed bool) []*chainhash.Hash + func CalcBlockTaxSubsidy(subsidyCache *SubsidyCache, keyheight int64, voters uint16, ...) int64 + func CalcBlockWorkSubsidy(subsidyCache *SubsidyCache, keyheight int64, voters uint16, ...) int64 + func CalcStakeVoteSubsidy(subsidyCache *SubsidyCache, height int64, params *chaincfg.Params) int64 + func CalcWork(bits uint32) *big.Int + func CalculateAddedSubsidy(block, parent *hcashutil.Block) int64 + func CheckBlockSanity(chain *BlockChain, block *hcashutil.Block, timeSource MedianTimeSource, ...) error + func CheckProofOfStake(block *hcashutil.Block, posLimit int64) error + func CheckProofOfWork(chain *BlockChain, block *hcashutil.Block, powLimit *big.Int, ...) error + func CheckTransactionInputs(chain *BlockChain, subsidyCache *SubsidyCache, tx *hcashutil.Tx, ...) (int64, int64, int64, error) + func CheckTransactionSanity(tx *wire.MsgTx, params *chaincfg.Params) error + func CheckWorklessBlockSanity(chain *BlockChain, block *hcashutil.Block, timeSource MedianTimeSource, ...) error + func CoinbasePaysTax(subsidyCache *SubsidyCache, tx *hcashutil.Tx, keyheight uint32, voters uint16, ...) error + func CompactToBig(compact uint32) *big.Int + func ConvertUtxosToMinimalOutputs(entry *UtxoEntry) []*stake.MinimalOutput + func CountP2SHSigOps(tx *hcashutil.Tx, isCoinBaseTx bool, isStakeBaseTx bool, ...) (int, error) + func CountSigOps(tx *hcashutil.Tx, isCoinBaseTx bool, isSSGen bool) int + func DBFetchBlockByHeight(dbTx database.Tx, height int64) (*hcashutil.Block, error) + func DBFetchHeaderByHeight(dbTx database.Tx, height int64) (*wire.BlockHeader, error) + func DBMainChainHasBlock(dbTx database.Tx, hash *chainhash.Hash) bool + func DisableLog() + func DumpBlockChain(db database.DB, height int64) (map[int64][]byte, error) + func FakeBlock(blockVersion int32, height int64, stakeVersion uint32) *hcashutil.Block + func FakeBlockFromHeader(header *wire.BlockHeader) *hcashutil.Block + func HashMerkleBranches(left *chainhash.Hash, right *chainhash.Hash) *chainhash.Hash + func HashToBig(hash *chainhash.Hash) *big.Int + func IsCoinBase(tx *hcashutil.Tx) bool + func IsCoinBaseTx(msgTx *wire.MsgTx) bool + func IsFinalizedTransaction(tx *hcashutil.Tx, blockKeyHeight int64, blockTime time.Time) bool + func NewBlockNodeEx(blockHeader *wire.BlockHeader, ticketsSpent []chainhash.Hash, ...) *blockNode + func SetMaxMedianTimeEntries(val int) + func ToTimeSorter(time_series []time.Time) sort.Interface + func UseLogger(logger btclog.Logger) + func ValidateTransactionScripts(tx *hcashutil.Tx, utxoView *UtxoViewpoint, flags txscript.ScriptFlags, ...) error + type AssertError string + func (e AssertError) Error() string + type BehaviorFlags uint32 + const BFDryRun + const BFFastAdd + const BFNoPoWCheck + const BFNone + type BestState struct + Bits uint32 + BlockSize uint64 + Hash *chainhash.Hash + Height int64 + KeyHeight int64 + MedianTime time.Time + NumTxns uint64 + TotalSubsidy int64 + TotalTxns uint64 + type BlockAcceptedNtfnsData struct + Block *hcashutil.Block + OnMainChain bool + type BlockChain struct + func New(config *Config) (*BlockChain, error) + func SetupTestChain(dbName string, params *chaincfg.Params) (*BlockChain, func(), error) + func (b *BlockChain) BestPrevHash() (chainhash.Hash, chainhash.Hash) + func (b *BlockChain) BestRealKeyHeight() int64 + func (b *BlockChain) BestSnapshot() *BestState + func (b *BlockChain) BlockByHash(hash *chainhash.Hash) (*hcashutil.Block, error) + func (b *BlockChain) BlockByHeight(blockHeight int64) (*hcashutil.Block, error) + func (b *BlockChain) BlockHashByHeight(blockHeight int64) (*chainhash.Hash, error) + func (b *BlockChain) BlockHeightByHash(hash *chainhash.Hash) (int64, error) + func (b *BlockChain) BlockLocatorFromHash(hash *chainhash.Hash) BlockLocator + func (b *BlockChain) CalcNextRequiredDiffFromNode(hash *chainhash.Hash, timestamp time.Time) (uint32, error) + func (b *BlockChain) CalcNextRequiredDifficulty(timestamp time.Time) (uint32, error) + func (b *BlockChain) CalcNextRequiredStakeDifficulty() (int64, error) + func (b *BlockChain) CalcStakeVersionByHash(hash *chainhash.Hash) (uint32, error) + func (b *BlockChain) CalcWantHeight(interval, height int64) int64 + func (b *BlockChain) CheckBlockHeaderContextEx(header *wire.BlockHeader, prevNode *blockNode, flags BehaviorFlags) error + func (b *BlockChain) CheckBlockStakeSanity(stakeValidationHeight int64, node *blockNode, block *hcashutil.Block, ...) error + func (b *BlockChain) CheckConnectBlock(block *hcashutil.Block, isMining bool) error + func (b *BlockChain) CheckExpiredTicket(hash chainhash.Hash) bool + func (b *BlockChain) CheckExpiredTickets(hashes []chainhash.Hash) []bool + func (b *BlockChain) CheckLiveTicket(hash chainhash.Hash) bool + func (b *BlockChain) CheckLiveTickets(hashes []chainhash.Hash) []bool + func (b *BlockChain) CheckMissedTickets(hashes []chainhash.Hash) []bool + func (b *BlockChain) Checkpoints() []chaincfg.Checkpoint + func (b *BlockChain) CountVoteVersion(version uint32) (uint32, error) + func (b *BlockChain) DisableCheckpoints(disable bool) + func (b *BlockChain) DisableVerify(disable bool) + func (b *BlockChain) EstimateNextStakeDifficulty(newTickets int64, useMaxTickets bool) (int64, error) + func (b *BlockChain) FetchBlockFromHash(hash *chainhash.Hash) (*hcashutil.Block, error) + func (b *BlockChain) FetchSubsidyCache() *SubsidyCache + func (b *BlockChain) FetchUtxoEntry(txHash *chainhash.Hash) (*UtxoEntry, error) + func (b *BlockChain) FetchUtxoView(tx *hcashutil.Tx, treeValid bool) (*UtxoViewpoint, error) + func (b *BlockChain) ForceHeadReorganization(formerBest chainhash.Hash, newBest chainhash.Hash) error + func (b *BlockChain) GetBlockKeyHeight(height int64) (int64, error) + func (b *BlockChain) GetDescendants(hash chainhash.Hash) ([]chainhash.Hash, error) + func (b *BlockChain) GetGeneration(hash chainhash.Hash) ([]chainhash.Hash, error) + func (b *BlockChain) GetKeyGeneration(hash chainhash.Hash) ([]chainhash.Hash, error) + func (b *BlockChain) GetMatchedDescendants(hash chainhash.Hash, voteResult uint16) ([]chainhash.Hash, error) + func (b *BlockChain) GetOrphanRoot(hash *chainhash.Hash) *chainhash.Hash + func (b *BlockChain) GetPrevHashByHash(hash *chainhash.Hash) *chainhash.Hash + func (b *BlockChain) GetStakeVersions(hash *chainhash.Hash, count int32) ([]StakeVersions, error) + func (b *BlockChain) GetTopBlock() (*hcashutil.Block, error) + func (b *BlockChain) GetTotalFeesByHash(hash *chainhash.Hash) (int64, error) + func (b *BlockChain) GetVoteCounts(version uint32, deploymentID string) (VoteCounts, error) + func (b *BlockChain) GetVoteInfo(hash *chainhash.Hash, version uint32) (*VoteInfo, error) + func (b *BlockChain) HaveBlock(hash *chainhash.Hash) (bool, error) + func (b *BlockChain) HaveBlockV2(hash *chainhash.Hash) (bool, error) + func (b *BlockChain) HeaderByHeight(height int64) (*wire.BlockHeader, error) + func (b *BlockChain) HeightRange(startHeight, endHeight int64) ([]chainhash.Hash, error) + func (b *BlockChain) IsCheckpointCandidate(block *hcashutil.Block) (bool, error) + func (b *BlockChain) IsCurrent() bool + func (b *BlockChain) IsKnownOrphan(hash *chainhash.Hash) bool + func (b *BlockChain) KeyHeightByHeight(height int64, keyHeightCache map[int64]int64) (int64, error) + func (b *BlockChain) LatestBlockLocator() (BlockLocator, error) + func (b *BlockChain) LatestCheckpoint() *chaincfg.Checkpoint + func (b *BlockChain) LiveTickets() ([]chainhash.Hash, error) + func (b *BlockChain) LotteryDataForBlock(hash *chainhash.Hash) ([]chainhash.Hash, int, [6]byte, error) + func (b *BlockChain) MainChainHasBlock(hash *chainhash.Hash) (bool, error) + func (b *BlockChain) MaxBlockSize() (int64, error) + func (b *BlockChain) MissedTickets() ([]chainhash.Hash, error) + func (b *BlockChain) NextLotteryData() ([]chainhash.Hash, int, [6]byte, error) + func (b *BlockChain) ProcessBlock(block *hcashutil.Block, flags BehaviorFlags) (bool, bool, error) + func (b *BlockChain) ThresholdState(hash *chainhash.Hash, version uint32, deploymentID string) (ThresholdStateTuple, error) + func (b *BlockChain) TicketPoolValue() (hcashutil.Amount, error) + func (b *BlockChain) TicketsWithAddress(address hcashutil.Address) ([]chainhash.Hash, error) + func (b *BlockChain) TotalSubsidy() int64 + type BlockLocator []*chainhash.Hash + type Config struct + ChainParams *chaincfg.Params + DB database.DB + IndexManager IndexManager + Notifications NotificationCallback + SigCache *txscript.SigCache + TimeSource MedianTimeSource + type DeploymentError string + func (e DeploymentError) Error() string + type ErrorCode int + const ErrBadBlockHeight + const ErrBadCheckpoint + const ErrBadCoinbaseAmountIn + const ErrBadCoinbaseFraudProof + const ErrBadCoinbaseOutpoint + const ErrBadCoinbaseScriptLen + const ErrBadCoinbaseValue + const ErrBadFees + const ErrBadMerkleRoot + const ErrBadStakeVersion + const ErrBadStakebaseAmountIn + const ErrBadStakebaseScrVal + const ErrBadStakebaseScriptLen + const ErrBadStakebaseValue + const ErrBadTxInput + const ErrBadTxOutValue + const ErrBlockOneInputs + const ErrBlockOneOutputs + const ErrBlockOneTx + const ErrBlockTooBig + const ErrBlockVersionTooOld + const ErrCheckpointTimeTooOld + const ErrCoinbaseHeight + const ErrDifficultyTooLow + const ErrDiscordantTxTree + const ErrDoubleSpend + const ErrDuplicateBlock + const ErrDuplicateTx + const ErrDuplicateTxInputs + const ErrExpiredTx + const ErrExpiryTxSpentEarly + const ErrFirstTxNotCoinbase + const ErrForceReorgMissingChild + const ErrForceReorgWrongChain + const ErrForkTooOld + const ErrFraudAmountIn + const ErrFraudBlockHeight + const ErrFraudBlockIndex + const ErrFreshStakeMismatch + const ErrHighHash + const ErrImmatureSpend + const ErrIncongruentVotebit + const ErrInvalidEarlyStakeTx + const ErrInvalidEarlyVoteBits + const ErrInvalidFinalState + const ErrInvalidSSGenInput + const ErrInvalidSSRtx + const ErrInvalidSSRtxInput + const ErrInvalidTime + const ErrMissingParent + const ErrMissingTx + const ErrMultipleCoinbases + const ErrNoStakeTx + const ErrNoSuchBlockHash + const ErrNoTax + const ErrNoTransactions + const ErrNoTxInputs + const ErrNoTxOutputs + const ErrNonstandardStakeTx + const ErrNotEnoughStake + const ErrNotEnoughVotes + const ErrOverwriteTx + const ErrPoolSize + const ErrRegTxInStakeTree + const ErrRegTxSpendStakeOut + const ErrRevocationsMismatch + const ErrSSGenPayeeNum + const ErrSSGenPayeeOuts + const ErrSSGenSubsidy + const ErrSSRtxPayees + const ErrSSRtxPayeesMismatch + const ErrSStxCommitment + const ErrSStxInImmature + const ErrSStxInScrType + const ErrScriptMalformed + const ErrScriptValidation + const ErrSpendTooHigh + const ErrStakeBelowMinimum + const ErrStakeFees + const ErrStakeTxInRegularTree + const ErrTicketUnavailable + const ErrTimeTooNew + const ErrTimeTooOld + const ErrTooManyRevocations + const ErrTooManySStxs + const ErrTooManySigOps + const ErrTooManyTransactions + const ErrTooManyVotes + const ErrTxSStxOutSpend + const ErrTxTooBig + const ErrUnexpectedDifficulty + const ErrUnfinalizedTx + const ErrUnparseableSSGen + const ErrVoteBitsNotCompatible + const ErrVotesMismatch + const ErrVotesOnWrongBlock + const ErrWrongBlockSize + const ErrZeroValueOutputSpend + func (e ErrorCode) String() string + type HashError string + func (e HashError) Error() string + type IndexManager interface + ConnectBlock func(database.Tx, *hcashutil.Block, *hcashutil.Block, *UtxoViewpoint) error + DisconnectBlock func(database.Tx, *hcashutil.Block, *hcashutil.Block, *UtxoViewpoint) error + Init func(*BlockChain) error + type MedianTimeSource interface + AddTimeSample func(id string, timeVal time.Time) + AdjustedTime func() time.Time + Offset func() time.Duration + func NewMedianTime() MedianTimeSource + type Notification struct + Data interface{} + Type NotificationType + type NotificationCallback func(*Notification) + type NotificationType int + const NTBlockAccepted + const NTBlockConnected + const NTBlockDisconnected + const NTNewTickets + const NTReorganization + const NTSpentAndMissedTickets + func (n NotificationType) String() string + type ReorganizationNtfnsData struct + NewHash chainhash.Hash + NewHeight int64 + OldHash chainhash.Hash + OldHeight int64 + type RuleError struct + Description string + ErrorCode ErrorCode + func (e RuleError) Error() string + type StakeVersions struct + BlockVersion int32 + Hash chainhash.Hash + Height int64 + StakeVersion uint32 + Votes []VoteVersionTuple + type StakeViewpoint int8 + type SubsidyCache struct + func NewSubsidyCache(keyHeight int64, params *chaincfg.Params) *SubsidyCache + func (s *SubsidyCache) CalcBlockSubsidy(keyheight int64) int64 + type ThresholdState byte + const ThresholdActive + const ThresholdDefined + const ThresholdFailed + const ThresholdInvalid + const ThresholdLockedIn + const ThresholdStarted + func (t ThresholdState) String() string + type ThresholdStateTuple struct + Choice uint32 + State ThresholdState + func (t ThresholdStateTuple) String() string + type TicketNotificationsData struct + Hash chainhash.Hash + Height int64 + StakeDifficulty int64 + TicketsMissed []chainhash.Hash + TicketsNew []chainhash.Hash + TicketsSpent []chainhash.Hash + type UtxoEntry struct + func (entry *UtxoEntry) AmountByIndex(outputIndex uint32) int64 + func (entry *UtxoEntry) BlockHeight() int64 + func (entry *UtxoEntry) BlockIndex() uint32 + func (entry *UtxoEntry) Clone() *UtxoEntry + func (entry *UtxoEntry) HasExpiry() bool + func (entry *UtxoEntry) IsCoinBase() bool + func (entry *UtxoEntry) IsFullySpent() bool + func (entry *UtxoEntry) IsOutputSpent(outputIndex uint32) bool + func (entry *UtxoEntry) PkScriptByIndex(outputIndex uint32) []byte + func (entry *UtxoEntry) ScriptVersionByIndex(outputIndex uint32) uint16 + func (entry *UtxoEntry) SpendOutput(outputIndex uint32) + func (entry *UtxoEntry) TransactionType() stake.TxType + func (entry *UtxoEntry) TxVersion() uint16 + type UtxoViewpoint struct + func NewUtxoViewpoint() *UtxoViewpoint + func (view *UtxoViewpoint) AddTxOuts(tx *hcashutil.Tx, blockHeight int64, blockIndex uint32) + func (view *UtxoViewpoint) BestHash() *chainhash.Hash + func (view *UtxoViewpoint) Entries() map[chainhash.Hash]*UtxoEntry + func (view *UtxoViewpoint) LookupEntry(txHash *chainhash.Hash) *UtxoEntry + func (view *UtxoViewpoint) SetBestHash(hash *chainhash.Hash) + func (view *UtxoViewpoint) SetStakeViewpoint(sv StakeViewpoint) + func (view *UtxoViewpoint) StakeViewpoint() StakeViewpoint + type VoteCounts struct + Total uint32 + TotalAbstain uint32 + VoteChoices []uint32 + type VoteInfo struct + AgendaStatus []ThresholdStateTuple + Agendas []chaincfg.ConsensusDeployment + type VoteVersionError uint32 + func (e VoteVersionError) Error() string + type VoteVersionTuple struct + Bits uint16 + Version uint32