only republish the next few messages from your mempool

This commit is contained in:
whyrusleeping 2020-07-28 16:31:05 -07:00
parent c3ff29cd7f
commit 7b29a1ae73

View File

@ -40,6 +40,8 @@ const futureDebug = false
const ReplaceByFeeRatio = 1.25 const ReplaceByFeeRatio = 1.25
const repubMsgLimit = 5
var ( var (
rbfNum = types.NewInt(uint64((ReplaceByFeeRatio - 1) * 256)) rbfNum = types.NewInt(uint64((ReplaceByFeeRatio - 1) * 256))
rbfDenom = types.NewInt(256) rbfDenom = types.NewInt(256)
@ -269,6 +271,10 @@ func (mp *MessagePool) repubLocal() {
log.Infow("republishing local messages", "n", len(outputMsgs)) log.Infow("republishing local messages", "n", len(outputMsgs))
} }
if len(outputMsgs) > repubMsgLimit {
outputMsgs = outputMsgs[:repubMsgLimit]
}
for _, msg := range outputMsgs { for _, msg := range outputMsgs {
msgb, err := msg.Serialize() msgb, err := msg.Serialize()
if err != nil { if err != nil {