Skip to content

Commit

Permalink
Don't remove redeemers and skip mempool full revalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
someone235 committed Dec 6, 2023
1 parent c434022 commit 3e5a436
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ 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 @@ -101,27 +100,13 @@ func (mp *mempool) revalidateTransaction(transaction *model.MempoolTransaction)
}
if len(missingParents) > 0 {
log.Debugf("Removing transaction %s, it failed revalidation", transaction.TransactionID())
err := mp.removeTransaction(transaction.TransactionID(), true)
err := mp.removeTransaction(transaction.TransactionID(), false)
if err != nil {
return false, err
}
return false, nil
}

_, 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
}

return true, nil
}

Expand Down
4 changes: 0 additions & 4 deletions domain/miningmanager/miningmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,6 @@ func TestRevalidateHighPriorityTransactionsWithChain(t *testing.T) {
t.Fatal(err)
}

for i, transaction := range chain {
t.Logf("chain %d %s", i, consensushashing.TransactionID(transaction))
}

_, err = miningManager.ValidateAndInsertTransaction(chain[0], true, false)
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 3e5a436

Please sign in to comment.