2020-04-08 13:56:04 +03:00
|
|
|
package blockchainer
|
2018-03-14 10:36:59 +01:00
|
|
|
|
2018-11-26 22:12:33 +01:00
|
|
|
import (
|
2020-07-09 12:57:24 +03:00
|
|
|
"math/big"
|
|
|
|
|
2020-03-25 18:30:21 +03:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/config"
|
2020-03-03 17:21:42 +03: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"
|
2020-08-20 11:02:11 +03:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto"
|
2020-03-03 17:21:42 +03:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
2020-11-11 18:43:28 +03:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger"
|
2020-03-03 17:21:42 +03:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
2018-11-26 22:12:33 +01:00
|
|
|
)
|
2018-03-14 10:36:59 +01:00
|
|
|
|
|
|
|
// Blockchainer is an interface that abstract the implementation
|
|
|
|
// of the blockchain.
|
|
|
|
type Blockchainer interface {
|
2020-06-05 19:01:10 +03:00
|
|
|
ApplyPolicyToTxSet([]*transaction.Transaction) []*transaction.Transaction
|
2019-02-20 18:39:32 +01:00
|
|
|
GetConfig() config.ProtocolConfiguration
|
2020-01-14 15:32:07 +03:00
|
|
|
AddHeaders(...*block.Header) error
|
|
|
|
AddBlock(*block.Block) error
|
2020-05-29 17:20:00 +03:00
|
|
|
AddStateRoot(r *state.MPTRoot) error
|
2020-11-06 12:27:05 +03:00
|
|
|
CalculateClaimable(h util.Uint160, endHeight uint32) (*big.Int, error)
|
2019-11-07 20:47:48 +03:00
|
|
|
Close()
|
2020-11-27 13:55:48 +03:00
|
|
|
IsTxStillRelevant(t *transaction.Transaction, txpool *mempool.Pool, isPartialTx bool) bool
|
2018-03-14 10:36:59 +01:00
|
|
|
HeaderHeight() uint32
|
2020-01-14 15:32:07 +03:00
|
|
|
GetBlock(hash util.Uint256) (*block.Block, error)
|
2020-09-21 15:34:04 +03:00
|
|
|
GetCommittee() (keys.PublicKeys, error)
|
2019-11-28 19:06:09 +03:00
|
|
|
GetContractState(hash util.Uint160) *state.Contract
|
2020-07-28 16:36:47 +03:00
|
|
|
GetContractScriptHash(id int32) (util.Uint160, error)
|
2020-04-26 20:04:16 +03:00
|
|
|
GetEnrollments() ([]state.Validator, error)
|
2020-07-09 12:57:24 +03:00
|
|
|
GetGoverningTokenBalance(acc util.Uint160) (*big.Int, uint32)
|
2020-11-24 11:14:25 +03:00
|
|
|
ForEachNEP17Transfer(util.Uint160, func(*state.NEP17Transfer) (bool, error)) error
|
2018-03-14 10:36:59 +01:00
|
|
|
GetHeaderHash(int) util.Uint256
|
2020-01-14 15:32:07 +03:00
|
|
|
GetHeader(hash util.Uint256) (*block.Header, error)
|
2018-03-14 10:36:59 +01:00
|
|
|
CurrentHeaderHash() util.Uint256
|
|
|
|
CurrentBlockHash() util.Uint256
|
|
|
|
HasBlock(util.Uint256) bool
|
|
|
|
HasTransaction(util.Uint256) bool
|
2020-11-11 18:43:28 +03:00
|
|
|
GetAppExecResults(util.Uint256, trigger.Type) ([]state.AppExecResult, error)
|
2020-11-27 13:55:48 +03:00
|
|
|
GetNotaryDepositExpiration(acc util.Uint160) uint32
|
2020-09-25 12:40:57 +03:00
|
|
|
GetNativeContractScriptHash(string) (util.Uint160, error)
|
2020-07-11 13:10:57 +03:00
|
|
|
GetNextBlockValidators() ([]*keys.PublicKey, error)
|
2020-11-24 11:14:25 +03:00
|
|
|
GetNEP17Balances(util.Uint160) *state.NEP17Balances
|
2020-11-27 13:55:48 +03:00
|
|
|
GetNotaryContractScriptHash() util.Uint160
|
|
|
|
GetNotaryBalance(acc util.Uint160) *big.Int
|
|
|
|
GetPolicer() Policer
|
2020-04-26 20:04:16 +03:00
|
|
|
GetValidators() ([]*keys.PublicKey, error)
|
2020-08-05 11:30:14 +03:00
|
|
|
GetStandByCommittee() keys.PublicKeys
|
2020-06-23 18:15:55 +03:00
|
|
|
GetStandByValidators() keys.PublicKeys
|
2020-06-04 11:59:22 +03:00
|
|
|
GetStateProof(root util.Uint256, key []byte) ([][]byte, error)
|
2020-05-29 17:20:00 +03:00
|
|
|
GetStateRoot(height uint32) (*state.MPTRootState, error)
|
2020-06-18 13:50:30 +03:00
|
|
|
GetStorageItem(id int32, key []byte) *state.StorageItem
|
|
|
|
GetStorageItems(id int32) (map[string]*state.StorageItem, error)
|
2020-12-14 15:23:39 +03:00
|
|
|
GetTestVM(t trigger.Type, tx *transaction.Transaction, b *block.Block) *vm.VM
|
2019-02-20 18:39:32 +01:00
|
|
|
GetTransaction(util.Uint256) (*transaction.Transaction, uint32, error)
|
2020-01-15 10:52:59 +03:00
|
|
|
mempool.Feer // fee interface
|
2020-12-13 18:26:35 +03:00
|
|
|
ManagementContractHash() util.Uint160
|
2020-08-19 19:27:15 +03:00
|
|
|
PoolTx(t *transaction.Transaction, pools ...*mempool.Pool) error
|
2020-11-27 13:55:48 +03:00
|
|
|
PoolTxWithData(t *transaction.Transaction, data interface{}, mp *mempool.Pool, feer mempool.Feer, verificationFunction func(bc Blockchainer, t *transaction.Transaction, data interface{}) error) error
|
|
|
|
RegisterPostBlock(f func(Blockchainer, *mempool.Pool, *block.Block))
|
2020-05-12 17:20:41 +03:00
|
|
|
SubscribeForBlocks(ch chan<- *block.Block)
|
|
|
|
SubscribeForExecutions(ch chan<- *state.AppExecResult)
|
|
|
|
SubscribeForNotifications(ch chan<- *state.NotificationEvent)
|
|
|
|
SubscribeForTransactions(ch chan<- *transaction.Transaction)
|
2020-08-19 19:27:15 +03:00
|
|
|
VerifyTx(*transaction.Transaction) error
|
2020-08-20 11:02:11 +03:00
|
|
|
VerifyWitness(util.Uint160, crypto.Verifiable, *transaction.Witness, int64) error
|
2020-02-04 17:36:11 +03:00
|
|
|
GetMemPool() *mempool.Pool
|
2020-05-12 17:20:41 +03:00
|
|
|
UnsubscribeFromBlocks(ch chan<- *block.Block)
|
|
|
|
UnsubscribeFromExecutions(ch chan<- *state.AppExecResult)
|
|
|
|
UnsubscribeFromNotifications(ch chan<- *state.NotificationEvent)
|
|
|
|
UnsubscribeFromTransactions(ch chan<- *transaction.Transaction)
|
2018-03-14 10:36:59 +01:00
|
|
|
}
|