2018-03-14 09:36:59 +00:00
|
|
|
package core
|
|
|
|
|
2018-11-26 21:12:33 +00:00
|
|
|
import (
|
2020-03-25 15:30:21 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/config"
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/mempool"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
2018-11-26 21:12:33 +00:00
|
|
|
)
|
2018-03-14 09:36:59 +00:00
|
|
|
|
|
|
|
// Blockchainer is an interface that abstract the implementation
|
|
|
|
// of the blockchain.
|
|
|
|
type Blockchainer interface {
|
2020-02-18 17:16:38 +00:00
|
|
|
ApplyPolicyToTxSet([]mempool.TxWithFee) []mempool.TxWithFee
|
2019-02-20 17:39:32 +00:00
|
|
|
GetConfig() config.ProtocolConfiguration
|
2020-01-14 12:32:07 +00:00
|
|
|
AddHeaders(...*block.Header) error
|
|
|
|
AddBlock(*block.Block) error
|
2020-05-29 14:20:00 +00:00
|
|
|
AddStateRoot(r *state.MPTRoot) error
|
2020-02-25 13:15:17 +00:00
|
|
|
CalculateClaimable(value util.Fixed8, startHeight, endHeight uint32) (util.Fixed8, util.Fixed8, error)
|
2019-11-07 17:47:48 +00:00
|
|
|
Close()
|
2018-03-14 09:36:59 +00:00
|
|
|
HeaderHeight() uint32
|
2020-01-14 12:32:07 +00:00
|
|
|
GetBlock(hash util.Uint256) (*block.Block, error)
|
2019-11-28 16:06:09 +00:00
|
|
|
GetContractState(hash util.Uint160) *state.Contract
|
2020-03-05 14:48:30 +00:00
|
|
|
GetEnrollments() ([]*state.Validator, error)
|
2020-09-08 12:29:07 +00:00
|
|
|
ForEachNEP5Transfer(util.Uint160, *state.NEP5Transfer, func() (bool, error)) error
|
|
|
|
ForEachTransfer(util.Uint160, *state.Transfer, func() (bool, error)) error
|
2018-03-14 09:36:59 +00:00
|
|
|
GetHeaderHash(int) util.Uint256
|
2020-01-14 12:32:07 +00:00
|
|
|
GetHeader(hash util.Uint256) (*block.Header, error)
|
2018-03-14 09:36:59 +00:00
|
|
|
CurrentHeaderHash() util.Uint256
|
|
|
|
CurrentBlockHash() util.Uint256
|
|
|
|
HasBlock(util.Uint256) bool
|
|
|
|
HasTransaction(util.Uint256) bool
|
2019-11-28 16:06:09 +00:00
|
|
|
GetAssetState(util.Uint256) *state.Asset
|
|
|
|
GetAccountState(util.Uint160) *state.Account
|
2020-02-21 14:56:28 +00:00
|
|
|
GetAppExecResult(util.Uint256) (*state.AppExecResult, error)
|
2020-07-21 10:06:33 +00:00
|
|
|
GetNEP5Metadata(util.Uint160) (*state.NEP5Metadata, error)
|
2020-03-11 15:22:46 +00:00
|
|
|
GetNEP5Balances(util.Uint160) *state.NEP5Balances
|
2019-12-17 11:51:07 +00:00
|
|
|
GetValidators(txes ...*transaction.Transaction) ([]*keys.PublicKey, error)
|
2019-10-11 11:22:53 +00:00
|
|
|
GetScriptHashesForVerifying(*transaction.Transaction) ([]util.Uint160, error)
|
2020-06-04 08:59:22 +00:00
|
|
|
GetStateProof(root util.Uint256, key []byte) ([][]byte, error)
|
2020-05-29 14:20:00 +00:00
|
|
|
GetStateRoot(height uint32) (*state.MPTRootState, error)
|
2019-11-28 16:06:09 +00:00
|
|
|
GetStorageItem(scripthash util.Uint160, key []byte) *state.StorageItem
|
|
|
|
GetStorageItems(hash util.Uint160) (map[string]*state.StorageItem, error)
|
2020-08-06 16:25:43 +00:00
|
|
|
GetTestVM(tx *transaction.Transaction) *vm.VM
|
2019-02-20 17:39:32 +00:00
|
|
|
GetTransaction(util.Uint256) (*transaction.Transaction, uint32, error)
|
2020-03-09 13:56:37 +00:00
|
|
|
GetUnspentCoinState(util.Uint256) *state.UnspentCoin
|
2020-02-26 07:58:20 +00:00
|
|
|
References(t *transaction.Transaction) ([]transaction.InOut, error)
|
2020-01-15 07:52:59 +00:00
|
|
|
mempool.Feer // fee interface
|
2020-02-04 15:43:21 +00:00
|
|
|
PoolTx(*transaction.Transaction) error
|
2020-06-22 07:49:48 +00:00
|
|
|
StateHeight() uint32
|
2020-05-12 14:20:41 +00:00
|
|
|
SubscribeForBlocks(ch chan<- *block.Block)
|
|
|
|
SubscribeForExecutions(ch chan<- *state.AppExecResult)
|
|
|
|
SubscribeForNotifications(ch chan<- *state.NotificationEvent)
|
|
|
|
SubscribeForTransactions(ch chan<- *transaction.Transaction)
|
2020-01-14 12:32:07 +00:00
|
|
|
VerifyTx(*transaction.Transaction, *block.Block) error
|
2020-02-04 14:36:11 +00:00
|
|
|
GetMemPool() *mempool.Pool
|
2020-05-12 14:20:41 +00:00
|
|
|
UnsubscribeFromBlocks(ch chan<- *block.Block)
|
|
|
|
UnsubscribeFromExecutions(ch chan<- *state.AppExecResult)
|
|
|
|
UnsubscribeFromNotifications(ch chan<- *state.NotificationEvent)
|
|
|
|
UnsubscribeFromTransactions(ch chan<- *transaction.Transaction)
|
2018-03-14 09:36:59 +00:00
|
|
|
}
|