core: add GetUnspentCoinState() for future interops

This commit is contained in:
Roman Khimov 2019-10-11 14:16:53 +03:00
parent bfddf9b3f6
commit 19fd7f844e
3 changed files with 14 additions and 0 deletions

View file

@ -740,6 +740,15 @@ func (bc *Blockchain) GetAccountState(scriptHash util.Uint160) *AccountState {
return as
}
// GetUnspentCoinState returns unspent coin state for given tx hash.
func (bc *Blockchain) GetUnspentCoinState(hash util.Uint256) *UnspentCoinState {
ucs, err := getUnspentCoinStateFromStore(bc.memStore, hash)
if err != nil {
ucs, _ = getUnspentCoinStateFromStore(bc.Store, hash)
}
return ucs
}
// GetConfig returns the config stored in the blockchain
func (bc *Blockchain) GetConfig() config.ProtocolConfiguration {
return bc.config

View file

@ -26,6 +26,7 @@ type Blockchainer interface {
GetStorageItem(scripthash util.Uint160, key []byte) *StorageItem
GetStorageItems(hash util.Uint160) (map[string]*StorageItem, error)
GetTransaction(util.Uint256) (*transaction.Transaction, uint32, error)
GetUnspentCoinState(util.Uint256) *UnspentCoinState
References(t *transaction.Transaction) map[transaction.Input]*transaction.Output
Feer // fee interface
Verify(t *transaction.Transaction) error

View file

@ -91,6 +91,10 @@ func (chain testChain) GetTransaction(util.Uint256) (*transaction.Transaction, u
panic("TODO")
}
func (chain testChain) GetUnspentCoinState(util.Uint256) *core.UnspentCoinState {
panic("TODO")
}
func (chain testChain) GetMemPool() core.MemPool {
panic("TODO")
}