Skip to content

Commit

Permalink
removed MinFeePerNameclaimChar and its enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
BrannonKing committed Nov 12, 2021
1 parent c9aa091 commit 415ca0d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
8 changes: 0 additions & 8 deletions mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1155,14 +1155,6 @@ func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit, rejec
return nil, nil, txRuleError(wire.RejectInsufficientFee, str)
}

minFee = txscript.CalcMinClaimTrieFee(tx.MsgTx(), txscript.MinFeePerNameclaimChar)
if txFee < minFee {
str := fmt.Sprintf("transaction %v has %d fees which is under "+
"the required amount of %d for Claims", txHash, txFee,
minFee)
return nil, nil, txRuleError(wire.RejectInsufficientFee, str)
}

// Require that free transactions have sufficient priority to be mined
// in the next block. Transactions which are being added back to the
// memory pool from blocks that have been disconnected during a reorg
Expand Down
29 changes: 0 additions & 29 deletions txscript/nameclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,9 @@ import (
"bytes"
"fmt"
"unicode/utf8"

"github.com/lbryio/lbcd/wire"
)

const (
// MinFeePerNameclaimChar is the minimum claim fee per character in the name of an OP_CLAIM_NAME
// command that must be attached to transactions for it to be accepted into the memory pool.
// Rationale: current implementation of the claim trie uses more memory for longer name claims
// due to the fact that each chracater is assigned a trie node regardless of whether it contains
// any claims or not. In the future, we can switch to a radix tree implementation where empty
// nodes do not take up any memory and the minimum fee can be priced on a per claim basis.
MinFeePerNameclaimChar int64 = 200000

// MaxClaimScriptSize is the max claim script size in bytes, not including the script pubkey part of the script.
MaxClaimScriptSize = 8192

Expand Down Expand Up @@ -139,25 +129,6 @@ func StripClaimScriptPrefix(script []byte) []byte {
return script[cs.Size():]
}

// claimNameSize returns size of the name in a claim script or 0 if script is not a claimtrie transaction.
func claimNameSize(script []byte) int {
cs, err := DecodeClaimScript(script)
if err != nil {
return 0
}
return len(cs.Name())
}

// CalcMinClaimTrieFee calculates the minimum fee (mempool rule) required for transaction.
func CalcMinClaimTrieFee(tx *wire.MsgTx, minFeePerNameClaimChar int64) int64 {
var minFee int64
for _, txOut := range tx.TxOut {
// TODO maybe: lbrycrd ignored transactions that weren't OP_CLAIMNAME
minFee += int64(claimNameSize(txOut.PkScript))
}
return minFee * minFeePerNameClaimChar
}

func isClaimName(pops []parsedOpcode) bool {
return len(pops) > 5 &&
pops[0].opcode.value == OP_CLAIMNAME &&
Expand Down

0 comments on commit 415ca0d

Please sign in to comment.