2018-03-14 09:36:59 +00:00
|
|
|
package core
|
|
|
|
|
2018-11-26 21:12:33 +00:00
|
|
|
import (
|
2019-02-20 17:39:32 +00:00
|
|
|
"github.com/CityOfZion/neo-go/config"
|
2019-10-29 15:31:39 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/core/storage"
|
2019-02-20 17:39:32 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/core/transaction"
|
2018-11-26 21:12:33 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/util"
|
2019-10-29 15:31:39 +00:00
|
|
|
"github.com/CityOfZion/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 {
|
2019-02-20 17:39:32 +00:00
|
|
|
GetConfig() config.ProtocolConfiguration
|
2018-03-14 09:36:59 +00:00
|
|
|
AddHeaders(...*Header) error
|
|
|
|
AddBlock(*Block) error
|
|
|
|
BlockHeight() uint32
|
2019-11-07 17:47:48 +00:00
|
|
|
Close()
|
2018-03-14 09:36:59 +00:00
|
|
|
HeaderHeight() uint32
|
2018-03-23 20:36:59 +00:00
|
|
|
GetBlock(hash util.Uint256) (*Block, error)
|
2019-10-11 11:22:53 +00:00
|
|
|
GetContractState(hash util.Uint160) *ContractState
|
2018-03-14 09:36:59 +00:00
|
|
|
GetHeaderHash(int) util.Uint256
|
2019-02-20 17:39:32 +00:00
|
|
|
GetHeader(hash util.Uint256) (*Header, error)
|
2018-03-14 09:36:59 +00:00
|
|
|
CurrentHeaderHash() util.Uint256
|
|
|
|
CurrentBlockHash() util.Uint256
|
|
|
|
HasBlock(util.Uint256) bool
|
|
|
|
HasTransaction(util.Uint256) bool
|
2018-11-26 21:12:33 +00:00
|
|
|
GetAssetState(util.Uint256) *AssetState
|
2019-02-08 08:04:38 +00:00
|
|
|
GetAccountState(util.Uint160) *AccountState
|
2019-10-11 11:22:53 +00:00
|
|
|
GetScriptHashesForVerifying(*transaction.Transaction) ([]util.Uint160, error)
|
2019-10-11 11:08:21 +00:00
|
|
|
GetStorageItem(scripthash util.Uint160, key []byte) *StorageItem
|
|
|
|
GetStorageItems(hash util.Uint160) (map[string]*StorageItem, error)
|
2019-10-29 15:31:39 +00:00
|
|
|
GetTestVM() (*vm.VM, storage.Store)
|
2019-02-20 17:39:32 +00:00
|
|
|
GetTransaction(util.Uint256) (*transaction.Transaction, uint32, error)
|
2019-10-11 11:16:53 +00:00
|
|
|
GetUnspentCoinState(util.Uint256) *UnspentCoinState
|
2019-09-30 14:42:37 +00:00
|
|
|
References(t *transaction.Transaction) map[transaction.Input]*transaction.Output
|
Implement rpc server method: sendrawtransaction (#174)
* Added new config attributes: 'SecondsPerBlock','LowPriorityThreshold'
* Added new files:
* Added new method: CompareTo
* Fixed empty Slice case
* Added new methods: LessThan, GreaterThan, Equal, CompareTo
* Added new method: InputIntersection
* Added MaxTransactionSize, GroupOutputByAssetID
* Added ned method: ScriptHash
* Added new method: IsDoubleSpend
* Refactor blockchainer, Added Feer interface, Verify and GetMemPool method
* 1) Added MemPool
2) Added new methods to satisfy the blockchainer interface: IsLowPriority, Verify, GetMemPool
* Added new methods: RelayTxn, RelayDirectly
* Fixed tests
* Implemented RPC server method sendrawtransaction
* Refactor getrawtransaction, sendrawtransaction in separate methods
* Moved 'secondsPerBlock' to config file
* Implemented Kim suggestions:
1) Fixed data race issues
2) refactor Verify method
3) Get rid of unused InputIntersection method due to refactoring Verify method
4) Fixed bug in https://github.com/CityOfZion/neo-go/pull/174#discussion_r264108135
5) minor simplications of the code
* Fixed minor issues related to
1) space
2) getter methods do not need pointer on the receiver
3) error message
4) refactoring CompareTo method in uint256.go
* Fixed small issues
* Use sync.RWMutex instead of sync.Mutex
* Refined (R)Lock/(R)Unlock
* return error instead of bool in Verify methods
2019-03-20 12:30:05 +00:00
|
|
|
Feer // fee interface
|
2019-10-11 14:00:11 +00:00
|
|
|
VerifyTx(*transaction.Transaction, *Block) error
|
Implement rpc server method: sendrawtransaction (#174)
* Added new config attributes: 'SecondsPerBlock','LowPriorityThreshold'
* Added new files:
* Added new method: CompareTo
* Fixed empty Slice case
* Added new methods: LessThan, GreaterThan, Equal, CompareTo
* Added new method: InputIntersection
* Added MaxTransactionSize, GroupOutputByAssetID
* Added ned method: ScriptHash
* Added new method: IsDoubleSpend
* Refactor blockchainer, Added Feer interface, Verify and GetMemPool method
* 1) Added MemPool
2) Added new methods to satisfy the blockchainer interface: IsLowPriority, Verify, GetMemPool
* Added new methods: RelayTxn, RelayDirectly
* Fixed tests
* Implemented RPC server method sendrawtransaction
* Refactor getrawtransaction, sendrawtransaction in separate methods
* Moved 'secondsPerBlock' to config file
* Implemented Kim suggestions:
1) Fixed data race issues
2) refactor Verify method
3) Get rid of unused InputIntersection method due to refactoring Verify method
4) Fixed bug in https://github.com/CityOfZion/neo-go/pull/174#discussion_r264108135
5) minor simplications of the code
* Fixed minor issues related to
1) space
2) getter methods do not need pointer on the receiver
3) error message
4) refactoring CompareTo method in uint256.go
* Fixed small issues
* Use sync.RWMutex instead of sync.Mutex
* Refined (R)Lock/(R)Unlock
* return error instead of bool in Verify methods
2019-03-20 12:30:05 +00:00
|
|
|
GetMemPool() MemPool
|
2018-03-14 09:36:59 +00:00
|
|
|
}
|