diff --git a/config.go b/config.go index 63d3360a..a0ff80dc 100644 --- a/config.go +++ b/config.go @@ -50,8 +50,8 @@ const ( blockMaxSizeMin = 1000 blockMaxSizeMax = wire.MaxBlockPayload - 1000 defaultGenerate = false - defaultMaxOrphanTransactions = 1000 - defaultMaxOrphanTxSize = 5000 + defaultMaxOrphanTransactions = 100 + defaultMaxOrphanTxSize = mempool.MaxStandardTxSize defaultSigCacheMaxSize = 100000 sampleConfigFilename = "sample-btcd.conf" defaultTxIndex = false diff --git a/doc.go b/doc.go index 22f43df2..42c76e20 100644 --- a/doc.go +++ b/doc.go @@ -94,7 +94,7 @@ Application Options: --norelaypriority Do not require free or low-fee transactions to have high priority for relaying --maxorphantx= Max number of orphan transactions to keep in memory - (1000) + (100) --generate Generate (mine) bitcoins using the CPU --miningaddr= Add the specified payment address to the list of addresses to use for generated blocks -- At least diff --git a/mempool/policy.go b/mempool/policy.go index 58482c99..0e5fb1ff 100644 --- a/mempool/policy.go +++ b/mempool/policy.go @@ -19,10 +19,10 @@ const ( // that are considered standard in a pay-to-script-hash script. maxStandardP2SHSigOps = 15 - // maxStandardTxSize is the maximum size allowed for transactions that + // MaxStandardTxSize is the maximum size allowed for transactions that // are considered standard and will therefore be relayed and considered // for mining. - maxStandardTxSize = 100000 + MaxStandardTxSize = 100000 // maxStandardSigScriptSize is the maximum size allowed for a // transaction input signature script to be considered standard. This @@ -276,9 +276,9 @@ func checkTransactionStandard(tx *btcutil.Tx, height int32, // size of a transaction. This also helps mitigate CPU exhaustion // attacks. serializedLen := msgTx.SerializeSize() - if serializedLen > maxStandardTxSize { + if serializedLen > MaxStandardTxSize { str := fmt.Sprintf("transaction size of %v is larger than max "+ - "allowed size of %v", serializedLen, maxStandardTxSize) + "allowed size of %v", serializedLen, MaxStandardTxSize) return txRuleError(wire.RejectNonstandard, str) } diff --git a/mempool/policy_test.go b/mempool/policy_test.go index d616d6ed..9b4e660c 100644 --- a/mempool/policy_test.go +++ b/mempool/policy_test.go @@ -41,13 +41,13 @@ func TestCalcMinRequiredTxRelayFee(t *testing.T) { }, { "max standard tx size with default minimum relay fee", - maxStandardTxSize, + MaxStandardTxSize, DefaultMinRelayTxFee, 100000, }, { "max standard tx size with max satoshi relay fee", - maxStandardTxSize, + MaxStandardTxSize, btcutil.MaxSatoshi, btcutil.MaxSatoshi, }, @@ -360,7 +360,7 @@ func TestCheckTransactionStandard(t *testing.T) { TxOut: []*wire.TxOut{{ Value: 0, PkScript: bytes.Repeat([]byte{0x00}, - maxStandardTxSize+1), + MaxStandardTxSize+1), }}, LockTime: 0, }, diff --git a/sample-btcd.conf b/sample-btcd.conf index 9a8bc55b..7d4996ed 100644 --- a/sample-btcd.conf +++ b/sample-btcd.conf @@ -236,8 +236,8 @@ ; Require high priority for relaying free or low-fee transactions. ; norelaypriority=0 -; Limit orphan transaction pool to 1000 transactions. -; maxorphantx=1000 +; Limit orphan transaction pool to 100 transactions. +; maxorphantx=100 ; Do not accept transactions from remote peers. ; blocksonly=1