OSDN Git Service

merge bvm branch with master
authorColt <colt@ColtdeMBP.lan>
Tue, 5 Sep 2017 02:16:07 +0000 (10:16 +0800)
committerColt <colt@ColtdeMBP.lan>
Tue, 5 Sep 2017 02:16:07 +0000 (10:16 +0800)
1  2 
protocol/block.go
protocol/protocol.go

@@@ -5,14 -5,14 +5,12 @@@ import 
        "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
@@@ -71,13 -31,13 +31,13 @@@ var 
  // 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
@@@ -119,11 -79,7 +79,7 @@@ func NewChain(ctx context.Context, init
        }
        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 {