Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193]
	helo=mx.sourceforge.net)
	by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <jgarzik@bitpay.com>) id 1XEk6E-0002Rt-B9
	for bitcoin-development@lists.sourceforge.net;
	Tue, 05 Aug 2014 19:08:42 +0000
Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of bitpay.com
	designates 209.85.213.179 as permitted sender)
	client-ip=209.85.213.179; envelope-from=jgarzik@bitpay.com;
	helo=mail-ig0-f179.google.com; 
Received: from mail-ig0-f179.google.com ([209.85.213.179])
	by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128)
	(Exim 4.76) id 1XEk6D-0001sJ-Bo
	for bitcoin-development@lists.sourceforge.net;
	Tue, 05 Aug 2014 19:08:42 +0000
Received: by mail-ig0-f179.google.com with SMTP id h18so1671644igc.12
	for <bitcoin-development@lists.sourceforge.net>;
	Tue, 05 Aug 2014 12:08:36 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc:content-type;
	bh=ZPgqVMfo3RTSt4LEXeQmV1xZYLDmb4Mrla6hWs6o5Xg=;
	b=J8CzchLzxk53Atk4gYXdDU+SefdhG7qFqjYB7sUzcqCU+Wico3dwe+OWR7dzE77QEe
	TI8bRC3MrZ/Va4lPZHEeyrKajJe87c7EeIH76lv6IHpXvseagUcl/WEYbD7E2hXAaOGJ
	Elu/iM5pyTUmKev4x6itAkdBWBINURUOT7JL7QBm1GYj4YK3IjlZH6BW++Q7dSzcvF32
	3bBNPbURVmQ7JiWcs0M5wmIFM4GEgZUGeko872u3EtWUHr6kXHH5qvjRE9esW4yz7qoJ
	aATmFd1T/rxmw8ufh6HwsMised7jHUdHeOw6984l5AK51rHdEJ67vV78X9zchQU1q7Cm
	8ezQ==
X-Gm-Message-State: ALoCoQl7IyGKm5QSE/piMuRPR+8Giy7qG/nd12ocKzK+7ElJw+2RInw9WyfId8ZJqBUctgqdJzEr
X-Received: by 10.50.80.116 with SMTP id q20mr51604246igx.22.1407265714403;
	Tue, 05 Aug 2014 12:08:34 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.107.10.78 with HTTP; Tue, 5 Aug 2014 12:08:14 -0700 (PDT)
In-Reply-To: <CANEZrP0AXvF5EYvsdpYxGUi5yV9eD_8qUge80XCoaeyekfd67Q@mail.gmail.com>
References: <CA+iPb=HkxeVPF0SynxCPgUkq4msrdfayFrVNFjzg29rFwqXv1w@mail.gmail.com>
	<CAJHLa0O2wFq2Vs5Bes_8x1q_j0VC+U4DQkx=6GqT8w5e8Lh5Qg@mail.gmail.com>
	<CANEZrP0AXvF5EYvsdpYxGUi5yV9eD_8qUge80XCoaeyekfd67Q@mail.gmail.com>
From: Jeff Garzik <jgarzik@bitpay.com>
Date: Tue, 5 Aug 2014 15:08:14 -0400
Message-ID: <CAJHLa0PTCRZL5PzrQYehRKG5G_D1i9zRdoqy4EN2ooMf7rh_8A@mail.gmail.com>
To: Mike Hearn <mike@plan99.net>
Content-Type: multipart/alternative; boundary=089e0153668207b86504ffe695da
X-Spam-Score: -0.6 (/)
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
	1.0 HTML_MESSAGE           BODY: HTML included in message
	-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
	author's domain
	0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
	not necessarily valid
	-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
X-Headers-End: 1XEk6D-0001sJ-Bo
Cc: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] deterministic transaction expiration
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Tue, 05 Aug 2014 19:08:42 -0000

--089e0153668207b86504ffe695da
Content-Type: text/plain; charset=UTF-8

I feel like a lot of this will be driven by implementation, and costs of
changing the implementation.  Additional look-backs are of course doable,
but they incur some disk I/O costs.  The fields available in memory for
each mempool TX are

    uint256 tx_hash; // hash of next field
    CTransaction tx;
    int64_t nFee; // Cached to avoid expensive parent-transaction lookups
    size_t nTxSize; // ... and avoid recomputing tx size
    int64_t nTime; // Local time when entering the mempool
    double dPriority; // Priority when entering the mempool
    unsigned int nHeight; // Chain height when entering the mempool

As a first pass, we may prune the mempool without additional db lookups
quite easily based on time criteria.  Or, additional in-memory indexes may
be constructed to maintain hashes ordered by priority/fees.

Those techniques seem likely to be attempted before resorting to looking
back two or three TXs deep at coin age -- which I admit is an interesting
metric.

-- 
Jeff Garzik
Bitcoin core developer and open source evangelist
BitPay, Inc.      https://bitpay.com/

--089e0153668207b86504ffe695da
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div>I feel like a lot of this will be driven by impl=
ementation, and costs of changing the implementation.=C2=A0 Additional look=
-backs are of course doable, but they incur some disk I/O costs.=C2=A0 The =
fields available in memory for each mempool TX are<br>

<br></div><div>=C2=A0=C2=A0=C2=A0 uint256 tx_hash; // hash of next field<br=
></div><div>=C2=A0=C2=A0=C2=A0 CTransaction tx;<br>=C2=A0=C2=A0=C2=A0 int64=
_t nFee; // Cached to avoid expensive parent-transaction lookups<br>=C2=A0=
=C2=A0=C2=A0 size_t nTxSize; // ... and avoid recomputing tx size<br>

=C2=A0=C2=A0=C2=A0 int64_t nTime; // Local time when entering the mempool<b=
r>=C2=A0=C2=A0=C2=A0 double dPriority; // Priority when entering the mempoo=
l<br>=C2=A0=C2=A0=C2=A0 unsigned int nHeight; // Chain height when entering=
 the mempool<br><br></div>As a first pass, we may prune the mempool without=
 additional db lookups quite easily based on time criteria.=C2=A0 Or, addit=
ional in-memory indexes may be constructed to maintain hashes ordered by pr=
iority/fees.<br>

<br></div><div>Those techniques seem likely to be attempted before resortin=
g to looking back two or three TXs deep at coin age -- which I admit is an =
interesting metric.<br></div><div><div><div><div class=3D"gmail_extra"><br>

-- <br>Jeff Garzik<br>Bitcoin core developer and open source evangelist<br>=
BitPay, Inc. =C2=A0 =C2=A0 =C2=A0<a href=3D"https://bitpay.com/" target=3D"=
_blank">https://bitpay.com/</a>
</div></div></div></div></div>

--089e0153668207b86504ffe695da--