Commit aa1bced9 authored by Hugo's avatar Hugo

Merge branch 'branch_dev_hugo' of github.com:Hugo-Huang/plugin into branch_dev_hugo

parents cb944409 7e3eddc0
...@@ -216,7 +216,7 @@ func (cs *ConsensusState) Start() { ...@@ -216,7 +216,7 @@ func (cs *ConsensusState) Start() {
// Stop timer and receive routine // Stop timer and receive routine
func (cs *ConsensusState) Stop() { func (cs *ConsensusState) Stop() {
cs.timeoutTicker.Stop() cs.timeoutTicker.Stop()
cs.Quit <-struct{}{} cs.Quit <- struct{}{}
} }
//------------------------------------------------------------ //------------------------------------------------------------
......
...@@ -22,12 +22,12 @@ import ( ...@@ -22,12 +22,12 @@ import (
) )
const ( const (
numBufferedConnections = 10 numBufferedConnections = 10
maxNumPeers = 50 maxNumPeers = 50
tryListenSeconds = 5 tryListenSeconds = 5
handshakeTimeout = 20 // * time.Second, handshakeTimeout = 20 // * time.Second,
maxSendQueueSize = 1024 maxSendQueueSize = 1024
defaultSendTimeout = 60 * time.Second defaultSendTimeout = 60 * time.Second
//MaxMsgPacketPayloadSize define //MaxMsgPacketPayloadSize define
MaxMsgPacketPayloadSize = 10 * 1024 * 1024 MaxMsgPacketPayloadSize = 10 * 1024 * 1024
defaultDialTimeout = 3 * time.Second defaultDialTimeout = 3 * time.Second
......
...@@ -182,13 +182,13 @@ func (sc *SecretConnection) Read(data []byte) (n int, err error) { ...@@ -182,13 +182,13 @@ func (sc *SecretConnection) Read(data []byte) (n int, err error) {
} }
// Close Implements net.Conn // Close Implements net.Conn
func (sc *SecretConnection) Close() error { return sc.conn.Close() } func (sc *SecretConnection) Close() error { return sc.conn.Close() }
// LocalAddr ... // LocalAddr ...
func (sc *SecretConnection) LocalAddr() net.Addr { return sc.conn.(net.Conn).LocalAddr() } func (sc *SecretConnection) LocalAddr() net.Addr { return sc.conn.(net.Conn).LocalAddr() }
// RemoteAddr ... // RemoteAddr ...
func (sc *SecretConnection) RemoteAddr() net.Addr { return sc.conn.(net.Conn).RemoteAddr() } func (sc *SecretConnection) RemoteAddr() net.Addr { return sc.conn.(net.Conn).RemoteAddr() }
// SetDeadline ... // SetDeadline ...
func (sc *SecretConnection) SetDeadline(t time.Time) error { return sc.conn.(net.Conn).SetDeadline(t) } func (sc *SecretConnection) SetDeadline(t time.Time) error { return sc.conn.(net.Conn).SetDeadline(t) }
...@@ -352,7 +352,7 @@ func incr2Nonce(nonce *[24]byte) { ...@@ -352,7 +352,7 @@ func incr2Nonce(nonce *[24]byte) {
// increment nonce big-endian by 1 with wraparound. // increment nonce big-endian by 1 with wraparound.
func incrNonce(nonce *[24]byte) { func incrNonce(nonce *[24]byte) {
for i := 23; 0 <= i; i-- { for i := 23; 0 <= i; i-- {
nonce[i] ++ nonce[i]++
if nonce[i] != 0 { if nonce[i] != 0 {
return return
} }
......
...@@ -38,7 +38,7 @@ var ( ...@@ -38,7 +38,7 @@ var (
timeoutCommit int32 = 1000 timeoutCommit int32 = 1000
skipTimeoutCommit = false skipTimeoutCommit = false
createEmptyBlocks = false createEmptyBlocks = false
createEmptyBlocksInterval int32 // second createEmptyBlocksInterval int32 // second
validatorNodes = []string{"127.0.0.1:46656"} validatorNodes = []string{"127.0.0.1:46656"}
peerGossipSleepDuration int32 = 100 peerGossipSleepDuration int32 = 100
peerQueryMaj23SleepDuration int32 = 2000 peerQueryMaj23SleepDuration int32 = 2000
......
...@@ -29,6 +29,7 @@ const fee = 1e6 ...@@ -29,6 +29,7 @@ const fee = 1e6
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
var r *rand.Rand var r *rand.Rand
// TxHeightOffset needed // TxHeightOffset needed
var TxHeightOffset int64 var TxHeightOffset int64
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
) )
var ( var (
blocklog = log15.New("module", "tendermint-block") blocklog = log15.New("module", "tendermint-block")
// ConsensusCrypto define // ConsensusCrypto define
ConsensusCrypto crypto.Crypto ConsensusCrypto crypto.Crypto
) )
......
...@@ -43,7 +43,7 @@ const ( ...@@ -43,7 +43,7 @@ const (
// EvidenceType map define // EvidenceType map define
var ( var (
EvidenceType2Type map[string]reflect.Type EvidenceType2Type map[string]reflect.Type
EvidenceType2Obj map[string]Evidence EvidenceType2Obj map[string]Evidence
) )
// Evidence represents any provable malicious activity by a validator // Evidence represents any provable malicious activity by a validator
...@@ -270,13 +270,13 @@ func NewMockGoodEvidence(height int64, index int, address []byte) MockGoodEviden ...@@ -270,13 +270,13 @@ func NewMockGoodEvidence(height int64, index int, address []byte) MockGoodEviden
} }
// Height ... // Height ...
func (e MockGoodEvidence) Height() int64 { return e.MGHeight } func (e MockGoodEvidence) Height() int64 { return e.MGHeight }
// Address ... // Address ...
func (e MockGoodEvidence) Address() []byte { return e.MGAddress } func (e MockGoodEvidence) Address() []byte { return e.MGAddress }
// Index ... // Index ...
func (e MockGoodEvidence) Index() int { return e.MGIndex } func (e MockGoodEvidence) Index() int { return e.MGIndex }
// Hash ... // Hash ...
func (e MockGoodEvidence) Hash() []byte { func (e MockGoodEvidence) Hash() []byte {
...@@ -373,7 +373,7 @@ type MockEvidencePool struct { ...@@ -373,7 +373,7 @@ type MockEvidencePool struct {
func (m MockEvidencePool) PendingEvidence() []Evidence { return nil } func (m MockEvidencePool) PendingEvidence() []Evidence { return nil }
// AddEvidence ... // AddEvidence ...
func (m MockEvidencePool) AddEvidence(Evidence) error { return nil } func (m MockEvidencePool) AddEvidence(Evidence) error { return nil }
// Update ... // Update ...
func (m MockEvidencePool) Update(*TendermintBlock) {} func (m MockEvidencePool) Update(*TendermintBlock) {}
...@@ -31,7 +31,7 @@ var ( ...@@ -31,7 +31,7 @@ var (
randgen *rand.Rand randgen *rand.Rand
randMux sync.Mutex randMux sync.Mutex
// Fmt ... // Fmt ...
Fmt = fmt.Sprintf Fmt = fmt.Sprintf
) )
// Init ... // Init ...
...@@ -143,6 +143,7 @@ func MinInt(a, b int) int { ...@@ -143,6 +143,7 @@ func MinInt(a, b int) int {
} }
return b return b
} }
// MaxInt ... // MaxInt ...
func MaxInt(a, b int) int { func MaxInt(a, b int) int {
if a > b { if a > b {
......
...@@ -320,7 +320,7 @@ func (voteSet *VoteSet) SetPeerMaj23(peerID string, blockID *tmtypes.BlockID) { ...@@ -320,7 +320,7 @@ func (voteSet *VoteSet) SetPeerMaj23(peerID string, blockID *tmtypes.BlockID) {
if votesByBlock.peerMaj23 { if votesByBlock.peerMaj23 {
return // Nothing to do return // Nothing to do
} }
votesByBlock.peerMaj23 = true // No need to copy votes, already there. votesByBlock.peerMaj23 = true // No need to copy votes, already there.
} else { } else {
votesByBlock = newBlockVotes(true, voteSet.valSet.Size()) votesByBlock = newBlockVotes(true, voteSet.valSet.Size())
voteSet.votesByBlock[blockKey] = votesByBlock voteSet.votesByBlock[blockKey] = votesByBlock
......
...@@ -17,7 +17,7 @@ func calcCertHeightKey(height int64) []byte { ...@@ -17,7 +17,7 @@ func calcCertHeightKey(height int64) []byte {
} }
// ExecLocal_New 启用证书交易执行 // ExecLocal_New 启用证书交易执行
func (c *Cert) ExecLocal_New(payload *ct.CertNew, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Cert) ExecLocal_New(payload *ct.CertNew, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if !authority.IsAuthEnable { if !authority.IsAuthEnable {
clog.Error("Authority is not available. Please check the authority config or authority initialize error logs.") clog.Error("Authority is not available. Please check the authority config or authority initialize error logs.")
return nil, ct.ErrInitializeAuthority return nil, ct.ErrInitializeAuthority
...@@ -49,7 +49,7 @@ func (c *Cert) ExecLocal_New(payload *ct.CertNew, tx *types.Transaction, receipt ...@@ -49,7 +49,7 @@ func (c *Cert) ExecLocal_New(payload *ct.CertNew, tx *types.Transaction, receipt
} }
// ExecLocal_Update 更新证书交易执行 // ExecLocal_Update 更新证书交易执行
func (c *Cert) ExecLocal_Update(payload *ct.CertUpdate, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Cert) ExecLocal_Update(payload *ct.CertUpdate, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if !authority.IsAuthEnable { if !authority.IsAuthEnable {
clog.Error("Authority is not available. Please check the authority config or authority initialize error logs.") clog.Error("Authority is not available. Please check the authority config or authority initialize error logs.")
return nil, ct.ErrInitializeAuthority return nil, ct.ErrInitializeAuthority
...@@ -82,7 +82,7 @@ func (c *Cert) ExecLocal_Update(payload *ct.CertUpdate, tx *types.Transaction, r ...@@ -82,7 +82,7 @@ func (c *Cert) ExecLocal_Update(payload *ct.CertUpdate, tx *types.Transaction, r
} }
// ExecLocal_Normal 非证书变更交易执行 // ExecLocal_Normal 非证书变更交易执行
func (c *Cert) ExecLocal_Normal(payload *ct.CertNormal, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Cert) ExecLocal_Normal(payload *ct.CertNormal, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if !authority.IsAuthEnable { if !authority.IsAuthEnable {
clog.Error("Authority is not available. Please check the authority config or authority initialize error logs.") clog.Error("Authority is not available. Please check the authority config or authority initialize error logs.")
return nil, ct.ErrInitializeAuthority return nil, ct.ErrInitializeAuthority
......
...@@ -11,7 +11,7 @@ import ( ...@@ -11,7 +11,7 @@ import (
) )
// ExecDelLocal_Hlock Action // ExecDelLocal_Hlock Action
func (h *Hashlock) ExecDelLocal_Hlock(hlock *pty.HashlockLock, tx *types.Transaction, receipt types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (h *Hashlock) ExecDelLocal_Hlock(hlock *pty.HashlockLock, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if receipt.GetTy() != types.ExecOk { if receipt.GetTy() != types.ExecOk {
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
} }
...@@ -24,7 +24,7 @@ func (h *Hashlock) ExecDelLocal_Hlock(hlock *pty.HashlockLock, tx *types.Transac ...@@ -24,7 +24,7 @@ func (h *Hashlock) ExecDelLocal_Hlock(hlock *pty.HashlockLock, tx *types.Transac
} }
// ExecDelLocal_Hsend Action // ExecDelLocal_Hsend Action
func (h *Hashlock) ExecDelLocal_Hsend(hsend *pty.HashlockSend, tx *types.Transaction, receipt types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (h *Hashlock) ExecDelLocal_Hsend(hsend *pty.HashlockSend, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if receipt.GetTy() != types.ExecOk { if receipt.GetTy() != types.ExecOk {
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
} }
...@@ -37,7 +37,7 @@ func (h *Hashlock) ExecDelLocal_Hsend(hsend *pty.HashlockSend, tx *types.Transac ...@@ -37,7 +37,7 @@ func (h *Hashlock) ExecDelLocal_Hsend(hsend *pty.HashlockSend, tx *types.Transac
} }
// ExecDelLocal_Hunlock Action // ExecDelLocal_Hunlock Action
func (h *Hashlock) ExecDelLocal_Hunlock(hunlock *pty.HashlockUnlock, tx *types.Transaction, receipt types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (h *Hashlock) ExecDelLocal_Hunlock(hunlock *pty.HashlockUnlock, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if receipt.GetTy() != types.ExecOk { if receipt.GetTy() != types.ExecOk {
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
} }
......
...@@ -11,7 +11,7 @@ import ( ...@@ -11,7 +11,7 @@ import (
) )
// ExecLocal_Hlock Action // ExecLocal_Hlock Action
func (h *Hashlock) ExecLocal_Hlock(hlock *pty.HashlockLock, tx *types.Transaction, receipt types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (h *Hashlock) ExecLocal_Hlock(hlock *pty.HashlockLock, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if receipt.GetTy() != types.ExecOk { if receipt.GetTy() != types.ExecOk {
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
} }
...@@ -25,7 +25,7 @@ func (h *Hashlock) ExecLocal_Hlock(hlock *pty.HashlockLock, tx *types.Transactio ...@@ -25,7 +25,7 @@ func (h *Hashlock) ExecLocal_Hlock(hlock *pty.HashlockLock, tx *types.Transactio
} }
// ExecLocal_Hsend Action // ExecLocal_Hsend Action
func (h *Hashlock) ExecLocal_Hsend(hsend *pty.HashlockSend, tx *types.Transaction, receipt types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (h *Hashlock) ExecLocal_Hsend(hsend *pty.HashlockSend, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if receipt.GetTy() != types.ExecOk { if receipt.GetTy() != types.ExecOk {
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
} }
...@@ -39,7 +39,7 @@ func (h *Hashlock) ExecLocal_Hsend(hsend *pty.HashlockSend, tx *types.Transactio ...@@ -39,7 +39,7 @@ func (h *Hashlock) ExecLocal_Hsend(hsend *pty.HashlockSend, tx *types.Transactio
} }
// ExecLocal_Hunlock Action // ExecLocal_Hunlock Action
func (h *Hashlock) ExecLocal_Hunlock(hunlock *pty.HashlockUnlock, tx *types.Transaction, receipt types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (h *Hashlock) ExecLocal_Hunlock(hunlock *pty.HashlockUnlock, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if receipt.GetTy() != types.ExecOk { if receipt.GetTy() != types.ExecOk {
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
} }
......
...@@ -49,7 +49,7 @@ func DelRetrieveInfo(info *rt.RetrieveQuery, Status int64, db dbm.KVDB) (*types. ...@@ -49,7 +49,7 @@ func DelRetrieveInfo(info *rt.RetrieveQuery, Status int64, db dbm.KVDB) (*types.
} }
// ExecDelLocal_Backup Action // ExecDelLocal_Backup Action
func (c *Retrieve) ExecDelLocal_Backup(backup *rt.BackupRetrieve, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Retrieve) ExecDelLocal_Backup(backup *rt.BackupRetrieve, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
set := &types.LocalDBSet{} set := &types.LocalDBSet{}
if receiptData.GetTy() != types.ExecOk { if receiptData.GetTy() != types.ExecOk {
return set, nil return set, nil
...@@ -70,7 +70,7 @@ func (c *Retrieve) ExecDelLocal_Backup(backup *rt.BackupRetrieve, tx *types.Tran ...@@ -70,7 +70,7 @@ func (c *Retrieve) ExecDelLocal_Backup(backup *rt.BackupRetrieve, tx *types.Tran
} }
// ExecDelLocal_Prepare Action // ExecDelLocal_Prepare Action
func (c *Retrieve) ExecDelLocal_Prepare(pre *rt.PrepareRetrieve, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Retrieve) ExecDelLocal_Prepare(pre *rt.PrepareRetrieve, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
set := &types.LocalDBSet{} set := &types.LocalDBSet{}
if receiptData.GetTy() != types.ExecOk { if receiptData.GetTy() != types.ExecOk {
return set, nil return set, nil
...@@ -91,7 +91,7 @@ func (c *Retrieve) ExecDelLocal_Prepare(pre *rt.PrepareRetrieve, tx *types.Trans ...@@ -91,7 +91,7 @@ func (c *Retrieve) ExecDelLocal_Prepare(pre *rt.PrepareRetrieve, tx *types.Trans
} }
// ExecDelLocal_Perform Action // ExecDelLocal_Perform Action
func (c *Retrieve) ExecDelLocal_Perform(perf *rt.PerformRetrieve, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Retrieve) ExecDelLocal_Perform(perf *rt.PerformRetrieve, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
set := &types.LocalDBSet{} set := &types.LocalDBSet{}
if receiptData.GetTy() != types.ExecOk { if receiptData.GetTy() != types.ExecOk {
return set, nil return set, nil
...@@ -112,7 +112,7 @@ func (c *Retrieve) ExecDelLocal_Perform(perf *rt.PerformRetrieve, tx *types.Tran ...@@ -112,7 +112,7 @@ func (c *Retrieve) ExecDelLocal_Perform(perf *rt.PerformRetrieve, tx *types.Tran
} }
// ExecDelLocal_Cancel Action // ExecDelLocal_Cancel Action
func (c *Retrieve) ExecDelLocal_Cancel(cancel *rt.CancelRetrieve, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Retrieve) ExecDelLocal_Cancel(cancel *rt.CancelRetrieve, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
set := &types.LocalDBSet{} set := &types.LocalDBSet{}
if receiptData.GetTy() != types.ExecOk { if receiptData.GetTy() != types.ExecOk {
return set, nil return set, nil
......
...@@ -52,7 +52,7 @@ func SaveRetrieveInfo(info *rt.RetrieveQuery, Status int64, db dbm.KVDB) (*types ...@@ -52,7 +52,7 @@ func SaveRetrieveInfo(info *rt.RetrieveQuery, Status int64, db dbm.KVDB) (*types
} }
// ExecLocal_Backup Action // ExecLocal_Backup Action
func (c *Retrieve) ExecLocal_Backup(backup *rt.BackupRetrieve, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Retrieve) ExecLocal_Backup(backup *rt.BackupRetrieve, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
set := &types.LocalDBSet{} set := &types.LocalDBSet{}
if receiptData.GetTy() != types.ExecOk { if receiptData.GetTy() != types.ExecOk {
return set, nil return set, nil
...@@ -72,7 +72,7 @@ func (c *Retrieve) ExecLocal_Backup(backup *rt.BackupRetrieve, tx *types.Transac ...@@ -72,7 +72,7 @@ func (c *Retrieve) ExecLocal_Backup(backup *rt.BackupRetrieve, tx *types.Transac
} }
// ExecLocal_Prepare Action // ExecLocal_Prepare Action
func (c *Retrieve) ExecLocal_Prepare(pre *rt.PrepareRetrieve, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Retrieve) ExecLocal_Prepare(pre *rt.PrepareRetrieve, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
set := &types.LocalDBSet{} set := &types.LocalDBSet{}
if receiptData.GetTy() != types.ExecOk { if receiptData.GetTy() != types.ExecOk {
return set, nil return set, nil
...@@ -93,7 +93,7 @@ func (c *Retrieve) ExecLocal_Prepare(pre *rt.PrepareRetrieve, tx *types.Transact ...@@ -93,7 +93,7 @@ func (c *Retrieve) ExecLocal_Prepare(pre *rt.PrepareRetrieve, tx *types.Transact
} }
// ExecLocal_Perform Action // ExecLocal_Perform Action
func (c *Retrieve) ExecLocal_Perform(perf *rt.PerformRetrieve, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Retrieve) ExecLocal_Perform(perf *rt.PerformRetrieve, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
set := &types.LocalDBSet{} set := &types.LocalDBSet{}
if receiptData.GetTy() != types.ExecOk { if receiptData.GetTy() != types.ExecOk {
return set, nil return set, nil
...@@ -114,7 +114,7 @@ func (c *Retrieve) ExecLocal_Perform(perf *rt.PerformRetrieve, tx *types.Transac ...@@ -114,7 +114,7 @@ func (c *Retrieve) ExecLocal_Perform(perf *rt.PerformRetrieve, tx *types.Transac
} }
// ExecLocal_Cancel Action // ExecLocal_Cancel Action
func (c *Retrieve) ExecLocal_Cancel(cancel *rt.CancelRetrieve, tx *types.Transaction, receiptData types.ExecTypeGet, index int) (*types.LocalDBSet, error) { func (c *Retrieve) ExecLocal_Cancel(cancel *rt.CancelRetrieve, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) {
set := &types.LocalDBSet{} set := &types.LocalDBSet{}
if receiptData.GetTy() != types.ExecOk { if receiptData.GetTy() != types.ExecOk {
return set, nil return set, nil
......
...@@ -251,7 +251,7 @@ type ExecutorType interface { ...@@ -251,7 +251,7 @@ type ExecutorType interface {
GetAssets(tx *Transaction) ([]*Asset, error) GetAssets(tx *Transaction) ([]*Asset, error)
} }
type ExecTypeGet interface { type execTypeGet interface {
GetTy() int32 GetTy() int32
} }
...@@ -466,7 +466,7 @@ func (base *ExecTypeBase) ActionName(tx *Transaction) string { ...@@ -466,7 +466,7 @@ func (base *ExecTypeBase) ActionName(tx *Transaction) string {
return "unknown-err" return "unknown-err"
} }
tm := base.child.GetTypeMap() tm := base.child.GetTypeMap()
if get, ok := payload.(ExecTypeGet); ok { if get, ok := payload.(execTypeGet); ok {
ty := get.GetTy() ty := get.GetTy()
for k, v := range tm { for k, v := range tm {
if v == ty { if v == ty {
......
...@@ -87,15 +87,11 @@ func ListMethodByType(typ reflect.Type) map[string]reflect.Method { ...@@ -87,15 +87,11 @@ func ListMethodByType(typ reflect.Type) map[string]reflect.Method {
return methods return methods
} }
type ExecutorAction interface {
GetTy() int32
}
var nilValue = reflect.ValueOf(nil) var nilValue = reflect.ValueOf(nil)
func GetActionValue(action interface{}, funclist map[string]reflect.Method) (string, int32, reflect.Value) { func GetActionValue(action interface{}, funclist map[string]reflect.Method) (string, int32, reflect.Value) {
var ty int32 var ty int32
if a, ok := action.(ExecutorAction); ok { if a, ok := action.(execTypeGet); ok {
ty = a.GetTy() ty = a.GetTy()
} }
value := reflect.ValueOf(action) value := reflect.ValueOf(action)
......
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