2020-04-08 10:56:04 +00:00
|
|
|
package blockchainer
|
2018-03-14 09:36:59 +00:00
|
|
|
|
2018-11-26 21:12:33 +00:00
|
|
|
import (
|
2020-07-09 09:57:24 +00:00
|
|
|
"math/big"
|
|
|
|
|
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"
|
2020-09-28 11:58:04 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/blockchainer/services"
|
2022-01-12 22:20:08 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
2020-03-03 14:21:42 +00:00
|
|
|
"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"
|
2021-03-25 12:22:16 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
2021-09-24 09:15:25 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result/subscriptions"
|
2020-11-11 15:43:28 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger"
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
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-06-05 16:01:10 +00:00
|
|
|
ApplyPolicyToTxSet([]*transaction.Transaction) []*transaction.Transaction
|
2022-01-14 01:09:54 +00:00
|
|
|
AddBlock(block *block.Block) error
|
|
|
|
AddHeaders(...*block.Header) error
|
|
|
|
BlockHeight() uint32
|
2019-02-20 17:39:32 +00:00
|
|
|
GetConfig() config.ProtocolConfiguration
|
2020-11-06 09:27:05 +00:00
|
|
|
CalculateClaimable(h util.Uint160, endHeight uint32) (*big.Int, error)
|
2019-11-07 17:47:48 +00:00
|
|
|
Close()
|
2022-01-12 22:34:46 +00:00
|
|
|
InitVerificationContext(ic *interop.Context, hash util.Uint160, witness *transaction.Witness) error
|
2020-11-27 10:55:48 +00:00
|
|
|
IsTxStillRelevant(t *transaction.Transaction, txpool *mempool.Pool, isPartialTx bool) bool
|
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)
|
2020-09-21 12:34:04 +00:00
|
|
|
GetCommittee() (keys.PublicKeys, error)
|
2019-11-28 16:06:09 +00:00
|
|
|
GetContractState(hash util.Uint160) *state.Contract
|
2020-07-28 13:36:47 +00:00
|
|
|
GetContractScriptHash(id int32) (util.Uint160, error)
|
2020-04-26 17:04:16 +00:00
|
|
|
GetEnrollments() ([]state.Validator, error)
|
2020-07-09 09:57:24 +00:00
|
|
|
GetGoverningTokenBalance(acc util.Uint160) (*big.Int, uint32)
|
2022-01-18 15:28:24 +00:00
|
|
|
ForEachNEP11Transfer(acc util.Uint160, newestTimestamp uint64, f func(*state.NEP11Transfer) (bool, error)) error
|
|
|
|
ForEachNEP17Transfer(acc util.Uint160, newestTimestamp uint64, f func(*state.NEP17Transfer) (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
|
2021-01-18 12:52:51 +00:00
|
|
|
IsExtensibleAllowed(util.Uint160) bool
|
2020-11-11 15:43:28 +00:00
|
|
|
GetAppExecResults(util.Uint256, trigger.Type) ([]state.AppExecResult, error)
|
2020-11-27 10:55:48 +00:00
|
|
|
GetNotaryDepositExpiration(acc util.Uint160) uint32
|
2020-09-25 09:40:57 +00:00
|
|
|
GetNativeContractScriptHash(string) (util.Uint160, error)
|
2021-02-09 09:25:38 +00:00
|
|
|
GetNatives() []state.NativeContract
|
2020-07-11 10:10:57 +00:00
|
|
|
GetNextBlockValidators() ([]*keys.PublicKey, error)
|
2021-11-16 20:09:04 +00:00
|
|
|
GetNEP11Contracts() []util.Uint160
|
2021-07-25 12:00:44 +00:00
|
|
|
GetNEP17Contracts() []util.Uint160
|
2021-11-16 20:09:04 +00:00
|
|
|
GetTokenLastUpdated(acc util.Uint160) (map[int32]uint32, error)
|
2020-11-27 10:55:48 +00:00
|
|
|
GetNotaryContractScriptHash() util.Uint160
|
|
|
|
GetNotaryBalance(acc util.Uint160) *big.Int
|
2022-03-01 10:10:54 +00:00
|
|
|
GetNotaryServiceFeePerKey() int64
|
2020-04-26 17:04:16 +00:00
|
|
|
GetValidators() ([]*keys.PublicKey, error)
|
2021-01-29 14:33:24 +00:00
|
|
|
GetStateModule() StateRoot
|
2021-03-05 14:06:54 +00:00
|
|
|
GetStorageItem(id int32, key []byte) state.StorageItem
|
2021-09-24 14:22:45 +00:00
|
|
|
GetStorageItems(id int32) ([]state.StorageItemWithKey, error)
|
2022-01-12 22:20:08 +00:00
|
|
|
GetTestVM(t trigger.Type, tx *transaction.Transaction, b *block.Block) *interop.Context
|
2019-02-20 17:39:32 +00:00
|
|
|
GetTransaction(util.Uint256) (*transaction.Transaction, uint32, error)
|
2020-09-28 11:58:04 +00:00
|
|
|
SetOracle(service services.Oracle)
|
2020-01-15 07:52:59 +00:00
|
|
|
mempool.Feer // fee interface
|
2020-12-13 15:26:35 +00:00
|
|
|
ManagementContractHash() util.Uint160
|
2020-08-19 16:27:15 +00:00
|
|
|
PoolTx(t *transaction.Transaction, pools ...*mempool.Pool) error
|
2022-01-14 01:09:54 +00:00
|
|
|
PoolTxWithData(t *transaction.Transaction, data interface{}, mp *mempool.Pool, feer mempool.Feer, verificationFunction func(t *transaction.Transaction, data interface{}) error) error
|
2020-12-30 08:01:13 +00:00
|
|
|
SetNotary(mod services.Notary)
|
2020-05-12 14:20:41 +00:00
|
|
|
SubscribeForBlocks(ch chan<- *block.Block)
|
|
|
|
SubscribeForExecutions(ch chan<- *state.AppExecResult)
|
2021-09-24 09:15:25 +00:00
|
|
|
SubscribeForNotifications(ch chan<- *subscriptions.NotificationEvent)
|
2020-05-12 14:20:41 +00:00
|
|
|
SubscribeForTransactions(ch chan<- *transaction.Transaction)
|
2020-08-19 16:27:15 +00:00
|
|
|
VerifyTx(*transaction.Transaction) error
|
2021-10-25 14:42:20 +00:00
|
|
|
VerifyWitness(util.Uint160, hash.Hashable, *transaction.Witness, int64) (int64, 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)
|
2021-09-24 09:15:25 +00:00
|
|
|
UnsubscribeFromNotifications(ch chan<- *subscriptions.NotificationEvent)
|
2020-05-12 14:20:41 +00:00
|
|
|
UnsubscribeFromTransactions(ch chan<- *transaction.Transaction)
|
2022-01-11 21:58:03 +00:00
|
|
|
// Policer.
|
|
|
|
GetBaseExecFee() int64
|
|
|
|
GetMaxVerificationGAS() int64
|
|
|
|
GetStoragePrice() int64
|
|
|
|
FeePerByte() int64
|
2018-03-14 09:36:59 +00:00
|
|
|
}
|