"fmt"
"time"
- // "github.com/blockchain/crypto/ed25519"
- "github.com/bytom/crypto/ed25519"
"github.com/bytom/errors"
"github.com/bytom/log"
"github.com/bytom/protocol/bc"
"github.com/bytom/protocol/bc/legacy"
"github.com/bytom/protocol/state"
"github.com/bytom/protocol/validation"
- // "github.com/blockchain/protocol/vm/vmutil"
- "github.com/bytom/protocol/vm/vmutil"
)
// maxBlockTxs limits the number of transactions
// and issuance memory. The Chain type uses Store to load state
// from storage and persist validated data.
type Store interface {
- Height() uint64
- GetBlock(uint64) (*legacy.Block, error)
+ Height(context.Context) (uint64, error)
+ GetBlock(context.Context, uint64) (*legacy.Block, error)
- // LatestSnapshot(context.Context) (*state.Snapshot, uint64, error)
+ LatestSnapshot(context.Context) (*state.Snapshot, uint64, error)
- // SaveBlock(context.Context, *legacy.Block) error
- SaveBlock(*legacy.Block) error
++ SaveBlock(context.Context, *legacy.Block) error
FinalizeBlock(context.Context, uint64) error
- // SaveSnapshot(context.Context, uint64, *state.Snapshot) error
+ SaveSnapshot(context.Context, uint64, *state.Snapshot) error
}
// Chain provides a complete, minimal blockchain database. It
}
c.state.cond.L = new(sync.Mutex)
- var err error
- c.state.height, err = store.Height(ctx)
- if err != nil {
- return nil, errors.Wrap(err, "looking up blockchain height")
- }
- c.state.height = store.Height()
++ c.state.height, _ = store.Height(ctx)
// Note that c.height.n may still be zero here.
if heights != nil {