Compare commits

...

3 Commits

Author SHA1 Message Date
Ori Newman
0871a3a498 Bump version to v0.12.14 2023-09-25 13:24:20 +03:00
Ori Newman
3ef88f8752 Fix position 2023-09-25 07:44:49 +03:00
Ori Newman
2b2690a619 Fix hasCoinbaseInput 2023-09-25 07:41:26 +03:00
4 changed files with 22 additions and 15 deletions

View File

@@ -149,12 +149,6 @@ func (mp *mempool) BlockCandidateTransactions() []*externalapi.DomainTransaction
var spamTxNewestUTXODaaScore uint64
for _, tx := range readyTxs {
if len(tx.Outputs) > len(tx.Inputs) {
numExtraOuts := len(tx.Outputs) - len(tx.Inputs)
if numExtraOuts > 2 && tx.Fee < uint64(numExtraOuts)*constants.SompiPerKaspa {
log.Debugf("Filtered spam tx %s", consensushashing.TransactionID(tx))
continue
}
hasCoinbaseInput := false
for _, input := range tx.Inputs {
if input.UTXOEntry.IsCoinbase() {
@@ -163,6 +157,12 @@ func (mp *mempool) BlockCandidateTransactions() []*externalapi.DomainTransaction
}
}
numExtraOuts := len(tx.Outputs) - len(tx.Inputs)
if !hasCoinbaseInput && numExtraOuts > 2 && tx.Fee < uint64(numExtraOuts)*constants.SompiPerKaspa {
log.Debugf("Filtered spam tx %s", consensushashing.TransactionID(tx))
continue
}
if hasCoinbaseInput || tx.Fee > uint64(numExtraOuts)*constants.SompiPerKaspa {
candidateTxs = append(candidateTxs, tx)
} else {

View File

@@ -2,8 +2,6 @@ package mempool
import (
"fmt"
"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
"github.com/kaspanet/kaspad/infrastructure/logger"
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
@@ -30,12 +28,6 @@ func (mp *mempool) validateAndInsertTransaction(transaction *externalapi.DomainT
return nil, err
}
numExtraOuts := len(transaction.Outputs) - len(transaction.Inputs)
if numExtraOuts > 2 && transaction.Fee < uint64(numExtraOuts)*constants.SompiPerKaspa {
log.Warnf("Rejected spam tx %s from mempool", consensushashing.TransactionID(transaction))
return nil, transactionRuleError(RejectSpamTx, fmt.Sprintf("Rejected spam tx %s from mempool", consensushashing.TransactionID(transaction)))
}
if len(missingOutpoints) > 0 {
if !allowOrphan {
str := fmt.Sprintf("Transaction %s is an orphan, where allowOrphan = false",

View File

@@ -2,6 +2,7 @@ package mempool
import (
"fmt"
"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
@@ -44,6 +45,20 @@ func (mp *mempool) validateTransactionInIsolation(transaction *externalapi.Domai
}
func (mp *mempool) validateTransactionInContext(transaction *externalapi.DomainTransaction) error {
hasCoinbaseInput := false
for _, input := range transaction.Inputs {
if input.UTXOEntry.IsCoinbase() {
hasCoinbaseInput = true
break
}
}
numExtraOuts := len(transaction.Outputs) - len(transaction.Inputs)
if !hasCoinbaseInput && numExtraOuts > 2 && transaction.Fee < uint64(numExtraOuts)*constants.SompiPerKaspa {
log.Warnf("Rejected spam tx %s from mempool (%d outputs)", consensushashing.TransactionID(transaction), len(transaction.Outputs))
return transactionRuleError(RejectSpamTx, fmt.Sprintf("Rejected spam tx %s from mempool", consensushashing.TransactionID(transaction)))
}
if !mp.config.AcceptNonStandard {
err := mp.checkTransactionStandardInContext(transaction)
if err != nil {

View File

@@ -11,7 +11,7 @@ const validCharacters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrs
const (
appMajor uint = 0
appMinor uint = 12
appPatch uint = 13
appPatch uint = 14
)
// appBuild is defined as a variable so it can be overridden during the build