Skip to content

Commit

Permalink
Ignore RejectDuplicate and swallow other rule errors
Browse files Browse the repository at this point in the history
  • Loading branch information
someone235 committed Dec 6, 2023
1 parent 348e4da commit b226d8e
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
"github.com/kaspanet/kaspad/domain/miningmanager/mempool/model"
"github.com/kaspanet/kaspad/infrastructure/logger"
"github.com/pkg/errors"
)

func (mp *mempool) revalidateHighPriorityTransactions() ([]*externalapi.DomainTransaction, error) {
Expand Down Expand Up @@ -109,6 +110,15 @@ func (mp *mempool) revalidateTransaction(transaction *model.MempoolTransaction)

_, err = mp.validateAndInsertTransaction(transaction.Transaction(), false, false)
if err != nil {
ruleError := TxRuleError{}
if errors.As(err, &ruleError) {
if ruleError.RejectCode == RejectDuplicate {
return true, nil
}

log.Debugf("Validation for high priority transaction %s failed: %s", transaction.TransactionID(), err)
return false, nil
}
return false, err
}

Expand Down

0 comments on commit b226d8e

Please sign in to comment.