Commit 1aad521a authored by hezhengjun's avatar hezhengjun

skip the old push

parent b3cf20db
...@@ -8,7 +8,6 @@ import ( ...@@ -8,7 +8,6 @@ import (
dbm "github.com/33cn/chain33/common/db" dbm "github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils" "github.com/33cn/plugin/plugin/dapp/cross2eth/ebrelayer/utils"
"github.com/pkg/errors"
) )
// SeqType // SeqType
...@@ -106,13 +105,17 @@ func (syncTx *EVMTxLogs) SaveAndSyncTxs2Relayer() { ...@@ -106,13 +105,17 @@ func (syncTx *EVMTxLogs) SaveAndSyncTxs2Relayer() {
// 处理输入流程 // 处理输入流程
func (syncTx *EVMTxLogs) dealEVMTxLogs(evmTxLogsInBlks *types.EVMTxLogsInBlks) { func (syncTx *EVMTxLogs) dealEVMTxLogs(evmTxLogsInBlks *types.EVMTxLogsInBlks) {
count, start, evmTxLogsParsed, err := parseEvmTxLogsInBlks(evmTxLogsInBlks, syncTx.seqNum) count, start, evmTxLogsParsed := parseEvmTxLogsInBlks(evmTxLogsInBlks, syncTx.seqNum)
if err != nil { txReceiptCount := len(evmTxLogsParsed)
resultCh <- err //重复注册推送接收保护,允许同一个中继服务在使用一段时间后,使用不同的推送名字重新进行注册,这样重复推送忽略就可以
//需要进行ack,否则该节点的推送将会停止
if 0 == txReceiptCount {
resultCh <- nil
return
} }
var height int64 var height int64
for i := 0; i < count; i++ { for i := 0; i < txReceiptCount; i++ {
txsPerBlock := evmTxLogsParsed[i] txsPerBlock := evmTxLogsParsed[i]
if txsPerBlock.AddDelType == SeqTypeAdd { if txsPerBlock.AddDelType == SeqTypeAdd {
syncTx.setTxLogsPerBlock(txsPerBlock) syncTx.setTxLogsPerBlock(txsPerBlock)
...@@ -206,7 +209,7 @@ func (syncTx *EVMTxLogs) delTxReceipts(height int64) { ...@@ -206,7 +209,7 @@ func (syncTx *EVMTxLogs) delTxReceipts(height int64) {
} }
// 检查输入是否有问题, 并解析输入 // 检查输入是否有问题, 并解析输入
func parseEvmTxLogsInBlks(evmTxLogs *types.EVMTxLogsInBlks, seqNumLast int64) (count int, start int64, txsWithReceipt []*types.EVMTxLogPerBlk, err error) { func parseEvmTxLogsInBlks(evmTxLogs *types.EVMTxLogsInBlks, seqNumLast int64) (count int, start int64, txsWithReceipt []*types.EVMTxLogPerBlk) {
count = len(evmTxLogs.Logs4EVMPerBlk) count = len(evmTxLogs.Logs4EVMPerBlk)
txsWithReceipt = make([]*types.EVMTxLogPerBlk, 0) txsWithReceipt = make([]*types.EVMTxLogPerBlk, 0)
start = math.MaxInt64 start = math.MaxInt64
...@@ -230,9 +233,9 @@ func parseEvmTxLogsInBlks(evmTxLogs *types.EVMTxLogsInBlks, seqNumLast int64) (c ...@@ -230,9 +233,9 @@ func parseEvmTxLogsInBlks(evmTxLogs *types.EVMTxLogsInBlks, seqNumLast int64) (c
"height", evmTxLogs.Logs4EVMPerBlk[i].Height, "seqOpType", seqOperationType[evmTxLogs.Logs4EVMPerBlk[i].AddDelType-1]) "height", evmTxLogs.Logs4EVMPerBlk[i].Height, "seqOpType", seqOperationType[evmTxLogs.Logs4EVMPerBlk[i].AddDelType-1])
} }
if len(txsWithReceipt) != count { if 0 == len(txsWithReceipt) {
err = errors.New("duplicate block's tx logs") log.Error("parseEvmTxLogsInBlks", "the valid number of tx receipt is", 0)
return
} }
return return
} }
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