From 8db5cef619cb042037b03e3235b58a72c4c2bf22 Mon Sep 17 00:00:00 2001 From: sh-cha Date: Tue, 5 Nov 2024 17:41:58 +0900 Subject: [PATCH] add it at load pending tx too --- node/broadcaster/broadcaster.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/node/broadcaster/broadcaster.go b/node/broadcaster/broadcaster.go index 114aa93..48fc6da 100644 --- a/node/broadcaster/broadcaster.go +++ b/node/broadcaster/broadcaster.go @@ -187,11 +187,18 @@ func (b *Broadcaster) prepareBroadcaster(ctx context.Context, lastBlockTime time } if txInfo.Save { - b.pendingProcessedMsgs = append(b.pendingProcessedMsgs, btypes.ProcessedMsgs{ - Msgs: msgs, - Timestamp: time.Now().UnixNano(), - Save: txInfo.Save, - }) + for i := 0; i < len(msgs); i += 5 { + end := i + 5 + if end > len(msgs) { + end = len(msgs) + } + + b.pendingProcessedMsgs = append(b.pendingProcessedMsgs, btypes.ProcessedMsgs{ + Msgs: msgs[i:end], + Timestamp: time.Now().UnixNano(), + Save: true, + }) + } } b.logger.Debug("pending tx", zap.Int("index", i), zap.String("tx", txInfo.String()))