Commit 34a91a59 authored by vipwzw's avatar vipwzw

update chain33

parent ebd5ec20
...@@ -943,7 +943,7 @@ func (bs *BlockStore) saveBlockSequence(storeBatch dbm.Batch, hash []byte, heigh ...@@ -943,7 +943,7 @@ func (bs *BlockStore) saveBlockSequence(storeBatch dbm.Batch, hash []byte, heigh
storeBatch.Set(calcSequenceToHashKey(newSequence), BlockSequenceByte) storeBatch.Set(calcSequenceToHashKey(newSequence), BlockSequenceByte)
//parachain hash->seq 只记录add block时的hash和seq对应关系 //parachain hash->seq 只记录add block时的hash和seq对应关系
if Type == AddBlock && isParaChain { if Type == AddBlock {
Sequencebytes := types.Encode(&types.Int64{Data: newSequence}) Sequencebytes := types.Encode(&types.Int64{Data: newSequence})
storeBatch.Set(calcHashToSequenceKey(hash), Sequencebytes) storeBatch.Set(calcHashToSequenceKey(hash), Sequencebytes)
} }
...@@ -991,7 +991,7 @@ func (bs *BlockStore) GetSequenceByHash(hash []byte) (int64, error) { ...@@ -991,7 +991,7 @@ func (bs *BlockStore) GetSequenceByHash(hash []byte) (int64, error) {
if err != dbm.ErrNotFoundInDb { if err != dbm.ErrNotFoundInDb {
storeLog.Error("GetSequenceByHash", "error", err) storeLog.Error("GetSequenceByHash", "error", err)
} }
return -1, types.ErrHeightNotExist return -1, types.ErrHashNotExist
} }
err = types.Decode(seqbytes, &seq) err = types.Decode(seqbytes, &seq)
......
...@@ -634,6 +634,7 @@ func testGetSeqByHash(t *testing.T, blockchain *blockchain.BlockChain) { ...@@ -634,6 +634,7 @@ func testGetSeqByHash(t *testing.T, blockchain *blockchain.BlockChain) {
reqBlock.IsDetail = true reqBlock.IsDetail = true
hashes := make([][]byte, 1) hashes := make([][]byte, 1)
Sequences, err := blockchain.GetBlockSequences(&reqBlock) Sequences, err := blockchain.GetBlockSequences(&reqBlock)
if err == nil && Sequences != nil { if err == nil && Sequences != nil {
for index, sequence := range Sequences.Items { for index, sequence := range Sequences.Items {
hashes[index] = sequence.Hash hashes[index] = sequence.Hash
...@@ -641,8 +642,8 @@ func testGetSeqByHash(t *testing.T, blockchain *blockchain.BlockChain) { ...@@ -641,8 +642,8 @@ func testGetSeqByHash(t *testing.T, blockchain *blockchain.BlockChain) {
} }
seq, _ := blockchain.ProcGetSeqByHash(hashes[0]) seq, _ := blockchain.ProcGetSeqByHash(hashes[0])
if seq != -1 { if seq == -1 {
t.Error("testGetSeqByHash only para chain GetSeqByHash ") t.Error(" GetSeqByHash err")
} }
chainlog.Info("testGetSeqByHash end --------------------") chainlog.Info("testGetSeqByHash end --------------------")
......
...@@ -455,11 +455,13 @@ func (chain *BlockChain) addParaChainBlockDetail(msg queue.Message) { ...@@ -455,11 +455,13 @@ func (chain *BlockChain) addParaChainBlockDetail(msg queue.Message) {
//parachian 通过blockhash获取对应的seq,只记录了addblock时的seq //parachian 通过blockhash获取对应的seq,只记录了addblock时的seq
func (chain *BlockChain) getSeqByHash(msg queue.Message) { func (chain *BlockChain) getSeqByHash(msg queue.Message) {
var sequence types.Int64
blockhash := (msg.Data).(*types.ReqHash) blockhash := (msg.Data).(*types.ReqHash)
sequence.Data, _ = chain.ProcGetSeqByHash(blockhash.Hash) seq, err := chain.ProcGetSeqByHash(blockhash.Hash)
msg.Reply(chain.client.NewMessage("rpc", types.EventGetSeqByHash, &sequence)) if err != nil {
chainlog.Error("getSeqByHash", "err", err.Error())
msg.Reply(chain.client.NewMessage("rpc", types.EventReply, err))
}
msg.Reply(chain.client.NewMessage("rpc", types.EventGetSeqByHash, &types.Int64{Data: seq}))
} }
//获取指定前缀key的数量 //获取指定前缀key的数量
......
...@@ -25,7 +25,7 @@ func TestReindex(t *testing.T) { ...@@ -25,7 +25,7 @@ func TestReindex(t *testing.T) {
chain := mock33.GetBlockChain() chain := mock33.GetBlockChain()
db := chain.GetDB() db := chain.GetDB()
kvs := getAllKeys(db) kvs := getAllKeys(db)
assert.Equal(t, len(kvs), 19) assert.Equal(t, len(kvs), 20)
defer mock33.Close() defer mock33.Close()
txs := util.GenCoinsTxs(mock33.GetGenesisKey(), 10) txs := util.GenCoinsTxs(mock33.GetGenesisKey(), 10)
for i := 0; i < len(txs); i++ { for i := 0; i < len(txs); i++ {
......
...@@ -101,6 +101,9 @@ func (m *mockBlockChain) SetQueueClient(q queue.Queue) { ...@@ -101,6 +101,9 @@ func (m *mockBlockChain) SetQueueClient(q queue.Queue) {
} else { } else {
msg.ReplyErr("Do not support", types.ErrInvalidParam) msg.ReplyErr("Do not support", types.ErrInvalidParam)
} }
case types.EventGetSeqByHash:
msg.Reply(client.NewMessage(blockchainKey, types.EventReplyQuery, &types.Int64{Data: 1}))
case types.EventIsSync: case types.EventIsSync:
msg.Reply(client.NewMessage(blockchainKey, types.EventReplyIsSync, &types.IsCaughtUp{})) msg.Reply(client.NewMessage(blockchainKey, types.EventReplyIsSync, &types.IsCaughtUp{}))
case types.EventIsNtpClockSync: case types.EventIsNtpClockSync:
......
...@@ -499,6 +499,29 @@ func (_m *QueueProtocolAPI) GetSeqCallBackLastNum(param *types.ReqString) (*type ...@@ -499,6 +499,29 @@ func (_m *QueueProtocolAPI) GetSeqCallBackLastNum(param *types.ReqString) (*type
return r0, r1 return r0, r1
} }
// GetSequenceByHash provides a mock function with given fields: param
func (_m *QueueProtocolAPI) GetSequenceByHash(param *types.ReqHash) (*types.Int64, error) {
ret := _m.Called(param)
var r0 *types.Int64
if rf, ok := ret.Get(0).(func(*types.ReqHash) *types.Int64); ok {
r0 = rf(param)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.Int64)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*types.ReqHash) error); ok {
r1 = rf(param)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetTransactionByAddr provides a mock function with given fields: param // GetTransactionByAddr provides a mock function with given fields: param
func (_m *QueueProtocolAPI) GetTransactionByAddr(param *types.ReqAddr) (*types.ReplyTxInfos, error) { func (_m *QueueProtocolAPI) GetTransactionByAddr(param *types.ReqAddr) (*types.ReplyTxInfos, error) {
ret := _m.Called(param) ret := _m.Called(param)
......
...@@ -898,6 +898,25 @@ func (q *QueueProtocol) GetLastBlockSequence() (*types.Int64, error) { ...@@ -898,6 +898,25 @@ func (q *QueueProtocol) GetLastBlockSequence() (*types.Int64, error) {
return nil, types.ErrTypeAsset return nil, types.ErrTypeAsset
} }
// GetSequenceByHash 通过hash获取对应的执行序列号
func (q *QueueProtocol) GetSequenceByHash(param *types.ReqHash) (*types.Int64, error) {
if param == nil {
err := types.ErrInvalidParam
log.Error("GetSequenceByHash", "Error", err)
return nil, err
}
msg, err := q.query(blockchainKey, types.EventGetSeqByHash, param)
if err != nil {
log.Error("GetSequenceByHash", "Error", err.Error())
return nil, err
}
if reply, ok := msg.GetData().(*types.Int64); ok {
return reply, nil
}
return nil, types.ErrTypeAsset
}
// WalletCreateTx create transaction // WalletCreateTx create transaction
func (q *QueueProtocol) WalletCreateTx(param *types.ReqCreateTransaction) (*types.Transaction, error) { func (q *QueueProtocol) WalletCreateTx(param *types.ReqCreateTransaction) (*types.Transaction, error) {
msg, err := q.query(walletKey, types.EventWalletCreateTx, param) msg, err := q.query(walletKey, types.EventWalletCreateTx, param)
......
...@@ -806,6 +806,7 @@ func TestGRPC(t *testing.T) { ...@@ -806,6 +806,7 @@ func TestGRPC(t *testing.T) {
testGetBlockOverviewGRPC(t, &grpcMock) testGetBlockOverviewGRPC(t, &grpcMock)
testGetAddrOverviewGRPC(t, &grpcMock) testGetAddrOverviewGRPC(t, &grpcMock)
testGetBlockHashGRPC(t, &grpcMock) testGetBlockHashGRPC(t, &grpcMock)
testGetSequenceByHashGRPC(t, &grpcMock)
testGenSeedGRPC(t, &grpcMock) testGenSeedGRPC(t, &grpcMock)
testGetSeedGRPC(t, &grpcMock) testGetSeedGRPC(t, &grpcMock)
testSaveSeedGRPC(t, &grpcMock) testSaveSeedGRPC(t, &grpcMock)
...@@ -1131,3 +1132,11 @@ func testSendTxGRPC(t *testing.T, rpc *mockGRPCSystem) { ...@@ -1131,3 +1132,11 @@ func testSendTxGRPC(t *testing.T, rpc *mockGRPCSystem) {
t.Error("Call SendTransaction Failed.", err) t.Error("Call SendTransaction Failed.", err)
} }
} }
func testGetSequenceByHashGRPC(t *testing.T, rpc *mockGRPCSystem) {
var res types.Int64
err := rpc.newRpcCtx("GetSequenceByHash", &types.ReqHash{}, &res)
if err != nil {
t.Error("Call GetSequenceByHash Failed.", err)
}
}
...@@ -111,6 +111,8 @@ type QueueProtocolAPI interface { ...@@ -111,6 +111,8 @@ type QueueProtocolAPI interface {
GetBlockSequences(param *types.ReqBlocks) (*types.BlockSequences, error) GetBlockSequences(param *types.ReqBlocks) (*types.BlockSequences, error)
//types.EventGetBlockByHashes: //types.EventGetBlockByHashes:
GetBlockByHashes(param *types.ReqHashes) (*types.BlockDetails, error) GetBlockByHashes(param *types.ReqHashes) (*types.BlockDetails, error)
//types.EventGetSequenceByHash:
GetSequenceByHash(param *types.ReqHash) (*types.Int64, error)
// --------------- blockchain interfaces end // --------------- blockchain interfaces end
......
...@@ -315,6 +315,12 @@ func (c *GrpcCtx) Run() (err error) { ...@@ -315,6 +315,12 @@ func (c *GrpcCtx) Run() (err error) {
*c.Res.(*types.NodeNetInfo) = *reply *c.Res.(*types.NodeNetInfo) = *reply
} }
errRet = err errRet = err
case "GetSequenceByHash":
reply, err := rpc.GetSequenceByHash(context.Background(), c.Params.(*types.ReqHash))
if err == nil {
*c.Res.(*types.Int64) = *reply
}
errRet = err
default: default:
errRet = errors.New(fmt.Sprintf("Unsupport method %v", c.Method)) errRet = errors.New(fmt.Sprintf("Unsupport method %v", c.Method))
} }
......
...@@ -345,6 +345,11 @@ func (g *Grpc) GetBlockByHashes(ctx context.Context, in *pb.ReqHashes) (*pb.Bloc ...@@ -345,6 +345,11 @@ func (g *Grpc) GetBlockByHashes(ctx context.Context, in *pb.ReqHashes) (*pb.Bloc
return g.cli.GetBlockByHashes(in) return g.cli.GetBlockByHashes(in)
} }
// GetSequenceByHash get block sequece by hash
func (g *Grpc) GetSequenceByHash(ctx context.Context, in *pb.ReqHash) (*pb.Int64, error) {
return g.cli.GetSequenceByHash(in)
}
// SignRawTx signature rawtransaction // SignRawTx signature rawtransaction
func (g *Grpc) SignRawTx(ctx context.Context, in *pb.ReqSignRawTx) (*pb.ReplySignRawTx, error) { func (g *Grpc) SignRawTx(ctx context.Context, in *pb.ReqSignRawTx) (*pb.ReplySignRawTx, error) {
return g.cli.SignRawTx(in) return g.cli.SignRawTx(in)
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
package rpc_test package rpc_test
import ( import (
"fmt"
"testing" "testing"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/rpc/jsonclient" "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types" rpctypes "github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
...@@ -19,16 +19,18 @@ import ( ...@@ -19,16 +19,18 @@ import (
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
) )
func getRPCClient(t *testing.T, mocker *testnode.Chain33Mock) *jsonclient.JSONClient {
jrpcClient := mocker.GetJSONC()
assert.NotNil(t, jrpcClient)
return jrpcClient
}
func TestErrLog(t *testing.T) { func TestErrLog(t *testing.T) {
// 启动RPCmocker // 启动RPCmocker
mocker := testnode.New("--free--", nil) mocker := testnode.New("--free--", nil)
defer mocker.Close() defer mocker.Close()
mocker.Listen() mocker.Listen()
jrpcClient := getRPCClient(t, mocker)
rpcCfg := mocker.GetCfg().RPC
jrpcClient, err := jsonclient.NewJSONClient(fmt.Sprintf("http://%s/", rpcCfg.JrpcBindAddr))
assert.NoError(t, err)
assert.NotNil(t, jrpcClient)
gen := mocker.GetGenesisKey() gen := mocker.GetGenesisKey()
//发送交易到区块链 //发送交易到区块链
addr1, key1 := util.Genaddress() addr1, key1 := util.Genaddress()
...@@ -55,3 +57,43 @@ func TestErrLog(t *testing.T) { ...@@ -55,3 +57,43 @@ func TestErrLog(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, string(testResult.Receipt.Logs[0].Log), `"ErrNoBalance"`) assert.Equal(t, string(testResult.Receipt.Logs[0].Log), `"ErrNoBalance"`)
} }
func getTx(t *testing.T, hex string) *types.Transaction {
data, err := common.FromHex(hex)
assert.Nil(t, err)
var tx types.Transaction
err = types.Decode(data, &tx)
assert.Nil(t, err)
return &tx
}
func TestSendToExec(t *testing.T) {
mocker := testnode.New("--free--", nil)
defer mocker.Close()
mocker.Listen()
jrpcClient := getRPCClient(t, mocker)
//1. 调用createrawtransaction 创建交易
req := &rpctypes.CreateTx{
To: address.ExecAddress("user.f3d"),
Amount: 10,
Fee: 1,
Note: "12312",
IsWithdraw: false,
IsToken: false,
TokenSymbol: "",
ExecName: "user.f3d",
}
var res string
err := jrpcClient.Call("Chain33.CreateRawTransaction", req, &res)
assert.Nil(t, err)
gen := mocker.GetGenesisKey()
tx := getTx(t, res)
tx.Sign(types.SECP256K1, gen)
reply, err := mocker.GetAPI().SendTx(tx)
assert.Nil(t, err)
_, err = mocker.WaitTx(reply.GetMsg())
assert.Nil(t, err)
block := mocker.GetLastBlock()
balance := mocker.GetExecAccount(block.StateHash, "user.f3d", mocker.GetGenesisAddress()).Balance
assert.Equal(t, int64(10), balance)
}
...@@ -76,6 +76,7 @@ type Consensus struct { ...@@ -76,6 +76,7 @@ type Consensus struct {
EmptyBlockInterval int64 `protobuf:"varint,24,opt,name=emptyBlockInterval" json:"emptyBlockInterval,omitempty"` EmptyBlockInterval int64 `protobuf:"varint,24,opt,name=emptyBlockInterval" json:"emptyBlockInterval,omitempty"`
AuthAccount string `protobuf:"bytes,25,opt,name=authAccount" json:"authAccount,omitempty"` AuthAccount string `protobuf:"bytes,25,opt,name=authAccount" json:"authAccount,omitempty"`
WaitBlocks4CommitMsg int32 `protobuf:"varint,26,opt,name=waitBlocks4CommitMsg" json:"waitBlocks4CommitMsg,omitempty"` WaitBlocks4CommitMsg int32 `protobuf:"varint,26,opt,name=waitBlocks4CommitMsg" json:"waitBlocks4CommitMsg,omitempty"`
SearchHashMatchedBlockDepth int32 `protobuf:"varint,27,opt,name=searchHashMatchedBlockDepth" json:"searchHashMatchedBlockDepth,omitempty"`
} }
// Wallet 配置 // Wallet 配置
......
...@@ -762,6 +762,36 @@ func (_m *Chain33Client) GetSeed(ctx context.Context, in *types.GetSeedByPw, opt ...@@ -762,6 +762,36 @@ func (_m *Chain33Client) GetSeed(ctx context.Context, in *types.GetSeedByPw, opt
return r0, r1 return r0, r1
} }
// GetSequenceByHash provides a mock function with given fields: ctx, in, opts
func (_m *Chain33Client) GetSequenceByHash(ctx context.Context, in *types.ReqHash, opts ...grpc.CallOption) (*types.Int64, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *types.Int64
if rf, ok := ret.Get(0).(func(context.Context, *types.ReqHash, ...grpc.CallOption) *types.Int64); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.Int64)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *types.ReqHash, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetTransactionByAddr provides a mock function with given fields: ctx, in, opts // GetTransactionByAddr provides a mock function with given fields: ctx, in, opts
func (_m *Chain33Client) GetTransactionByAddr(ctx context.Context, in *types.ReqAddr, opts ...grpc.CallOption) (*types.ReplyTxInfos, error) { func (_m *Chain33Client) GetTransactionByAddr(ctx context.Context, in *types.ReqAddr, opts ...grpc.CallOption) (*types.ReplyTxInfos, error) {
_va := make([]interface{}, len(opts)) _va := make([]interface{}, len(opts))
......
...@@ -125,6 +125,9 @@ service chain33 { ...@@ -125,6 +125,9 @@ service chain33 {
//获取指定区间的block加载序列号信息 //获取指定区间的block加载序列号信息
rpc GetBlockSequences(ReqBlocks) returns (BlockSequences) {} rpc GetBlockSequences(ReqBlocks) returns (BlockSequences) {}
//get add block's sequence by hash
rpc GetSequenceByHash(ReqHash) returns (Int64) {}
//通过block hash 获取对应的blocks信息 //通过block hash 获取对应的blocks信息
rpc GetBlockByHashes(ReqHashes) returns (BlockDetails) {} rpc GetBlockByHashes(ReqHashes) returns (BlockDetails) {}
//关闭chain33 //关闭chain33
......
...@@ -26,71 +26,72 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package ...@@ -26,71 +26,72 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) }
var fileDescriptor_77a6da22d6a3feb1 = []byte{ var fileDescriptor_77a6da22d6a3feb1 = []byte{
// 1020 bytes of a gzipped FileDescriptorProto // 1031 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xdd, 0x6f, 0xdb, 0x36, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xdd, 0x6f, 0xe2, 0x46,
0x10, 0xd7, 0xc3, 0xd6, 0x34, 0xac, 0xed, 0x38, 0x8c, 0x13, 0xb4, 0xc2, 0x8a, 0x02, 0x02, 0x86, 0x10, 0xf7, 0x43, 0x1b, 0x8e, 0x3d, 0x20, 0x64, 0x43, 0xa2, 0x3b, 0xab, 0xa7, 0x93, 0x2c, 0x55,
0x3d, 0x0c, 0xb5, 0x57, 0x7b, 0xcb, 0xbe, 0x07, 0xc4, 0xc9, 0xec, 0x18, 0x70, 0x3d, 0x37, 0x72, 0x7d, 0xa8, 0x0e, 0x7a, 0xd0, 0xa6, 0x1f, 0xd7, 0x56, 0x0a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 0xa9, 0xf2, 0x11, 0x57, 0x67, 0xa8, 0x21, 0x3b, 0xf4, 0x9a, 0xd0,
0x9a, 0xb9, 0x36, 0x7c, 0xf3, 0xf7, 0xeb, 0xb5, 0x2b, 0x6e, 0xc3, 0x65, 0xd7, 0x61, 0x9b, 0xde, 0xd5, 0x2c, 0xd8, 0xe0, 0x94, 0xeb, 0xf7, 0x42, 0x24, 0xff, 0x70, 0xc5, 0x30, 0x1c, 0xbe, 0xfd,
0x60, 0xe0, 0xd0, 0x5e, 0xf2, 0x3a, 0xee, 0x29, 0xe3, 0xe5, 0x33, 0xf5, 0x6c, 0x1e, 0xfc, 0x17, 0xe7, 0xcd, 0xda, 0xe6, 0xb7, 0xc1, 0xb2, 0x6b, 0xb9, 0x9b, 0xde, 0x60, 0x60, 0xd1, 0x5e, 0xfc,
0x00, 0x00, 0xff, 0xff, 0x95, 0xf0, 0xb7, 0x53, 0xb5, 0x0b, 0x00, 0x00, 0xa4, 0xee, 0x49, 0xe3, 0xe5, 0x81, 0x7c, 0x6b, 0x0f, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x2a,
0x38, 0xe4, 0x13, 0xea, 0x0b, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
...@@ -190,6 +191,8 @@ type Chain33Client interface { ...@@ -190,6 +191,8 @@ type Chain33Client interface {
GetLastBlockSequence(ctx context.Context, in *ReqNil, opts ...grpc.CallOption) (*Int64, error) GetLastBlockSequence(ctx context.Context, in *ReqNil, opts ...grpc.CallOption) (*Int64, error)
//获取指定区间的block加载序列号信息 //获取指定区间的block加载序列号信息
GetBlockSequences(ctx context.Context, in *ReqBlocks, opts ...grpc.CallOption) (*BlockSequences, error) GetBlockSequences(ctx context.Context, in *ReqBlocks, opts ...grpc.CallOption) (*BlockSequences, error)
//get add block's sequence by hash
GetSequenceByHash(ctx context.Context, in *ReqHash, opts ...grpc.CallOption) (*Int64, error)
//通过block hash 获取对应的blocks信息 //通过block hash 获取对应的blocks信息
GetBlockByHashes(ctx context.Context, in *ReqHashes, opts ...grpc.CallOption) (*BlockDetails, error) GetBlockByHashes(ctx context.Context, in *ReqHashes, opts ...grpc.CallOption) (*BlockDetails, error)
//关闭chain33 //关闭chain33
...@@ -607,6 +610,15 @@ func (c *chain33Client) GetBlockSequences(ctx context.Context, in *ReqBlocks, op ...@@ -607,6 +610,15 @@ func (c *chain33Client) GetBlockSequences(ctx context.Context, in *ReqBlocks, op
return out, nil return out, nil
} }
func (c *chain33Client) GetSequenceByHash(ctx context.Context, in *ReqHash, opts ...grpc.CallOption) (*Int64, error) {
out := new(Int64)
err := c.cc.Invoke(ctx, "/types.chain33/GetSequenceByHash", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chain33Client) GetBlockByHashes(ctx context.Context, in *ReqHashes, opts ...grpc.CallOption) (*BlockDetails, error) { func (c *chain33Client) GetBlockByHashes(ctx context.Context, in *ReqHashes, opts ...grpc.CallOption) (*BlockDetails, error) {
out := new(BlockDetails) out := new(BlockDetails)
err := c.cc.Invoke(ctx, "/types.chain33/GetBlockByHashes", in, out, opts...) err := c.cc.Invoke(ctx, "/types.chain33/GetBlockByHashes", in, out, opts...)
...@@ -748,6 +760,8 @@ type Chain33Server interface { ...@@ -748,6 +760,8 @@ type Chain33Server interface {
GetLastBlockSequence(context.Context, *ReqNil) (*Int64, error) GetLastBlockSequence(context.Context, *ReqNil) (*Int64, error)
//获取指定区间的block加载序列号信息 //获取指定区间的block加载序列号信息
GetBlockSequences(context.Context, *ReqBlocks) (*BlockSequences, error) GetBlockSequences(context.Context, *ReqBlocks) (*BlockSequences, error)
//get add block's sequence by hash
GetSequenceByHash(context.Context, *ReqHash) (*Int64, error)
//通过block hash 获取对应的blocks信息 //通过block hash 获取对应的blocks信息
GetBlockByHashes(context.Context, *ReqHashes) (*BlockDetails, error) GetBlockByHashes(context.Context, *ReqHashes) (*BlockDetails, error)
//关闭chain33 //关闭chain33
...@@ -1557,6 +1571,24 @@ func _Chain33_GetBlockSequences_Handler(srv interface{}, ctx context.Context, de ...@@ -1557,6 +1571,24 @@ func _Chain33_GetBlockSequences_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Chain33_GetSequenceByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqHash)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(Chain33Server).GetSequenceByHash(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.chain33/GetSequenceByHash",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(Chain33Server).GetSequenceByHash(ctx, req.(*ReqHash))
}
return interceptor(ctx, in, info, handler)
}
func _Chain33_GetBlockByHashes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Chain33_GetBlockByHashes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReqHashes) in := new(ReqHashes)
if err := dec(in); err != nil { if err := dec(in); err != nil {
...@@ -1846,6 +1878,10 @@ var _Chain33_serviceDesc = grpc.ServiceDesc{ ...@@ -1846,6 +1878,10 @@ var _Chain33_serviceDesc = grpc.ServiceDesc{
Handler: _Chain33_GetBlockSequences_Handler, Handler: _Chain33_GetBlockSequences_Handler,
}, },
{ {
MethodName: "GetSequenceByHash",
Handler: _Chain33_GetSequenceByHash_Handler,
},
{
MethodName: "GetBlockByHashes", MethodName: "GetBlockByHashes",
Handler: _Chain33_GetBlockByHashes_Handler, Handler: _Chain33_GetBlockByHashes_Handler,
}, },
......
...@@ -329,6 +329,14 @@ func (mock *Chain33Mock) GetAccount(stateHash []byte, addr string) *types.Accoun ...@@ -329,6 +329,14 @@ func (mock *Chain33Mock) GetAccount(stateHash []byte, addr string) *types.Accoun
return acc.LoadAccount(addr) return acc.LoadAccount(addr)
} }
//GetExecAccount :get execer account info
func (mock *Chain33Mock) GetExecAccount(stateHash []byte, execer, addr string) *types.Account {
statedb := executor.NewStateDB(mock.client, stateHash, nil, nil)
acc := account.NewCoinsAccount()
acc.SetDB(statedb)
return acc.LoadExecAccount(addr, address.ExecAddress(execer))
}
//GetBlock : //GetBlock :
func (mock *Chain33Mock) GetBlock(height int64) *types.Block { func (mock *Chain33Mock) GetBlock(height int64) *types.Block {
blocks, err := mock.api.GetBlocks(&types.ReqBlocks{Start: height, End: height}) blocks, err := mock.api.GetBlocks(&types.ReqBlocks{Start: height, End: height})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment