Compare commits

...

1 Commits

Author SHA1 Message Date
Ori Newman
0bbb307f84 Reject from mempool txs with too many outputs of less than 1 KAS 2023-09-25 01:36:54 +03:00

View File

@@ -2,6 +2,7 @@ package mempool
import (
"fmt"
"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
"github.com/kaspanet/kaspad/infrastructure/logger"
@@ -16,6 +17,18 @@ func (mp *mempool) validateAndInsertTransaction(transaction *externalapi.DomainT
fmt.Sprintf("validateAndInsertTransaction %s", consensushashing.TransactionID(transaction)))
defer onEnd()
numOutsLessThanOneKas := 0
for _, output := range transaction.Outputs {
if output.Value < constants.SompiPerKaspa {
numOutsLessThanOneKas += 1
}
}
if numOutsLessThanOneKas > len(transaction.Inputs) {
log.Warnf("Rejected transaction with %d outputs with less than 1 KAS")
return nil, nil
}
// Populate mass in the beginning, it will be used in multiple places throughout the validation and insertion.
mp.consensusReference.Consensus().PopulateMass(transaction)