forked from elastos/Elastos.ELA
/
ledgerstore.go
46 lines (33 loc) · 1.32 KB
/
ledgerstore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package blockchain
import (
. "github.com/elastos/Elastos.ELA/core"
. "github.com/elastos/Elastos.ELA.Utility/common"
)
// IChainStore provides func with store package.
type IChainStore interface {
InitWithGenesisBlock(genesisblock *Block) (uint32, error)
SaveBlock(b *Block) error
GetBlock(hash Uint256) (*Block, error)
GetBlockHash(height uint32) (Uint256, error)
IsDoubleSpend(tx *Transaction) bool
GetHeader(hash Uint256) (*Header, error)
RollbackBlock(hash Uint256) error
GetTransaction(txID Uint256) (*Transaction, uint32, error)
GetTxReference(tx *Transaction) (map[*Input]*Output, error)
PersistAsset(assetid Uint256, asset Asset) error
GetAsset(hash Uint256) (*Asset, error)
PersistSidechainTx(sidechainTxHash Uint256)
GetSidechainTx(sidechainTxHash Uint256) (byte, error)
GetCurrentBlockHash() Uint256
GetHeight() uint32
RemoveHeaderListElement(hash Uint256)
GetUnspent(txID Uint256, index uint16) (*Output, error)
ContainsUnspent(txID Uint256, index uint16) (bool, error)
GetUnspentFromProgramHash(programHash Uint168, assetid Uint256) ([]*UTXO, error)
GetUnspentsFromProgramHash(programHash Uint168) (map[Uint256][]*UTXO, error)
GetAssets() map[Uint256]*Asset
IsTxHashDuplicate(txhash Uint256) bool
IsSidechainTxHashDuplicate(sidechainTxHash Uint256) bool
IsBlockInStore(hash Uint256) bool
Close()
}