Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1UV6wh-0005ay-0s for bitcoin-development@lists.sourceforge.net; Wed, 24 Apr 2013 21:09:43 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of bluematt.me designates 173.246.101.161 as permitted sender) client-ip=173.246.101.161; envelope-from=bitcoin-list@bluematt.me; helo=mail.bluematt.me; Received: from vps.bluematt.me ([173.246.101.161] helo=mail.bluematt.me) by sog-mx-3.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1UV6wc-0000MH-Vh for bitcoin-development@lists.sourceforge.net; Wed, 24 Apr 2013 21:09:42 +0000 Received: from [192.168.1.6] (dhcp00757.north-resnet.unc.edu [152.23.202.249]) by mail.bluematt.me (Postfix) with ESMTPSA id 1C9EE5EED for ; Wed, 24 Apr 2013 21:09:33 +0000 (UTC) Message-ID: <1366837772.6035.19.camel@localhost.localdomain> From: Matt Corallo To: bitcoin-development Date: Wed, 24 Apr 2013 17:09:32 -0400 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.8.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1UV6wc-0000MH-Vh Subject: [Bitcoin-development] [RFC] Fees/Minimum Priorities based on Mempool and Memory-Limited Mempool X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2013 21:09:43 -0000 I hacked together a new min fee/prio calculator and memory-limited mempool a while back and figured Id post the code here to get some comments. Its more of a discussion-starter than a strict proposal and has a few obvious holes (hence posting here instead of pull-requesting). It works as such (note that all constants are really place-holders, so please recommend reasonable constants): 1) Watches when transactions enter mempool and calculates minimum fee/priority based on a fairly dumb algorithm... It finds the highest FEE_POLICY_TOP_N_TX (10) fee/prio transactions in mempool that have been in mempool at least FEE_POLICY_DETERMINATION_BLOCKS (6) blocks and averages together their fee/prio then multiplies by FEE_POLICY_FACTOR (1.1). 2) It limits mempool size to a default of 10*MAX_BLOCK_SIZE (bringing it down to 9*MAX_BLOCK_SIZE each time it has to throw out transaction). When transactions are throw out, it keeps 2/9 of the mempool size in highest-prio transactions and 7/9 of the mempool in highest-fee transactions. 3) Any transactions which have a fee lower than the lowest-fee transaction thrown out of the mempool and a priority lower than the lowest-priority transaction thrown out of the mempool will not be accepted into the mempool at all. Obvious bugs: 1) It doesnt yet do anything for minimum fee/prio when it hasnt seen at least FEE_POLICY_TOP_N_TX (10) transactions sitting in mempool for at least FEE_POLICY_DETERMINATION_BLOCKS (6) blocks (ie hasnt been running for 6 blocks or blocks are being filled completely). The likely way to address this is to look at previous blocks and find the lowest fee/prio transactions included in them. 2) It will relay all transactions until the mempool has filled up (or if the mempool never fills). Something should be done initially to limit DoS potential. Code is at https://github.com/TheBlueMatt/bitcoin/commits/fees Matt