4 "github.com/vapor/application/mov"
5 "github.com/vapor/config"
6 "github.com/vapor/consensus"
7 dbm "github.com/vapor/database/leveldb"
8 "github.com/vapor/errors"
9 "github.com/vapor/protocol/bc"
10 "github.com/vapor/protocol/bc/types"
17 type movCore interface {
18 ApplyBlock(block *types.Block) error
19 BeforeProposalBlock(capacity int) ([]*types.Tx, error)
20 ChainStatus() (uint64, *bc.Hash, error)
21 DetachBlock(block *types.Block) error
22 IsDust(tx *types.Tx) bool
23 ValidateBlock(block *types.Block) error
24 ValidateTxs(txs []*types.Tx) error
31 func NewMOV(db dbm.DB, startPoint consensus.Checkpoint) (*MOV, error) {
32 if startPoint.Height == 0 {
33 startPoint.Hash = config.GenesisBlock().Hash()
36 movCore, err := mov.NewMovCore(db, startPoint.Height, &startPoint.Hash)
38 return nil, errors.Wrap(err, "failed on create mov core")
46 func (m MOV) ApplyBlock(block *types.Block) error {
47 return m.core.ApplyBlock(block)
50 func (m MOV) BeforeProposalBlock(capacity int) ([]*types.Tx, error) {
51 return m.core.BeforeProposalBlock(capacity)
54 func (m MOV) ChainStatus() (uint64, *bc.Hash, error) {
55 return m.core.ChainStatus()
58 func (m MOV) DetachBlock(block *types.Block) error {
59 return m.core.DetachBlock(block)
62 func (m MOV) IsDust(tx *types.Tx) bool {
63 return m.core.IsDust(tx)
66 func (m MOV) Name() string {
70 func (m MOV) ValidateBlock(block *types.Block) error {
71 return m.core.ValidateBlock(block)
74 func (m MOV) ValidateTxs(txs []*types.Tx) error {
75 return m.core.ValidateTxs(txs)