From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 28 Jan 2025 15:09:50 -0800 Received: from mail-qt1-f185.google.com ([209.85.160.185]) by mail.fairlystable.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tcuiL-0007jX-Nf for bitcoindev@gnusha.org; Tue, 28 Jan 2025 15:09:50 -0800 Received: by mail-qt1-f185.google.com with SMTP id d75a77b69052e-467919046fbsf3814861cf.0 for ; Tue, 28 Jan 2025 15:09:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1738105783; cv=pass; d=google.com; s=arc-20240605; b=gj11XNJOUUaY252plysnO8JMYJnW0QRxtrqmWfV8UZfrfWvoO4tFahrolZpIsSuQnR n5pCqT+hGgNESlJ5MnWLYHz4CNsg29zjRWRfC6XDlZYv0HKY2RoCZOgdlOKGXazEcQ2U WxDNShn864jsoqGyCa/X6ClKm7T/z240ZnyvF8hc0MOmzeeWs1N8bMLuYaPeXqgZHnf6 7ppHC6GeLqdrLuGt7tk2hqLaNyBT9yoB6Qqrv7p2d1l/vwb7NVfg48U5Dvvu5mhegskP 3P1T1K/S2ua4AgQjoA7oMQAnZ817yEE+7h0X3pt5jROfEPw52HBxwPMiZrDQ2paEwmcn fyDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:content-disposition:mime-version :message-id:subject:to:from:date:feedback-id:sender:dkim-signature; bh=2HsBJb/jD/1mzVtd/lpo6n5TDlFcHuquBJbtFvKT5ug=; fh=uN9bHO+j1MgPCf8EziQpxFpPRwW95qsP/zl3pfJcAxE=; b=NcI7iR5kMeN8Hh77hZ86g4hhgTQ4pO9XI1qNdC2zADPhLXhUzkx/3Ebqgj7k70J3vT Q60Y6YBbvom5GxkkwKVNf6KDezMwRvSUK83HdklgwD4UO+6Si5zW4eFxJ7rdEcZmF97D moj14F9f05ReTY6bHMKCyvAH7rygV06zb+AMcygEVyWT0XAI5P/ZMdNWjWMyIB5jG+MC lstwCpeEgDzKH3Q5YuDxLl/KSFEk9fCbn+ue0tYUmNKkf+QOQEquwlmjFLKl/NWquWIc GaoQGwGWd3P49ZVrMRVXvQxpwMljO99jS7YIXh6xjCYGDoT41a0qXhPTIJRTdTSHEqnP wubA==; darn=gnusha.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TSSCl88W; spf=pass (google.com: domain of pete@petertodd.org designates 202.12.124.156 as permitted sender) smtp.mailfrom=pete@petertodd.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1738105783; x=1738710583; darn=gnusha.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:content-disposition:mime-version:message-id :subject:to:from:date:feedback-id:sender:from:to:cc:subject:date :message-id:reply-to; bh=2HsBJb/jD/1mzVtd/lpo6n5TDlFcHuquBJbtFvKT5ug=; b=OP7ChSFs7Hqy35wpl7Fzg4tL5Cc3R0w4PzSPjNbwSPQJLYp5/B2zhF7vo4/EGis2qW z/NhwSQYo8jf6Qqd8oV+KzWfwV4G7KwAJSoJn8Y9ap3tZRkZMhYtJKm/8pM9mQX0Lpjr MxU95tR/Ms2Mx21KsjKW9fzbzdeHJNglyW6C0elTVCLyjrHQCQ1PfPkUopktyDTp0WbM oswoDseXVloqzwFJDQea0mJpNYKUBxgZ7xqfGJeCJVxQRGrk+JDG87MgwB7xL2fv5ybs kXXtedekMaw4Y0l7Vt1Y2L7rul6jP0cGUkP0REplagPegnP5gU+BsjzUXYdEy8fltuc9 pR2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738105783; x=1738710583; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:content-disposition:mime-version:message-id :subject:to:from:date:feedback-id:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=2HsBJb/jD/1mzVtd/lpo6n5TDlFcHuquBJbtFvKT5ug=; b=RbnsBArG249y8HXiumbTnR9bJX4GD1wFnCHtN7DwT3Y1mBx5tAjbK9Dwii0oPz4U2m tgcfgelJJW/SyDfNXpFqKq+kpV1YL98TouZtSwtfPbIzNNHV0FwuuYQJLucE11e0ypAA zCSMNf+/IwIr6mbBK1KoHtbno1yIN43jWdYU+ed/lVL4JXYRi2DAZcwOinvnn83/4NbL GdPphykmrwWHQyU1kIkpamiC4YhZtCxuSwWaxOErGVzT6+QW/yeYBPaQPwCQmQVJSLcR SLG+o4iLVgAkSaAVs3JINob026G5ipqncQ0fiHUKeVwq3MhynrSqf0LAX9OWVqlx3TXm g6nw== Sender: bitcoindev@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXuSM4hHAxD8iFdyWP9+AUi4Kro7ee4NteDCOWTv9dhD1J8A492gh8zjManBqRR0f9/3tdGW2xJbFa9@gnusha.org X-Gm-Message-State: AOJu0YwdsIqkSQJIrkZYgZPnT5Q8tewzq1eRUgVGApPEFoOPJo2yHCX9 cGTVaBEEOc0BGdMx804Z78ktwBEWcRl/f9MLdCPBeaCRZ7eYk06J X-Google-Smtp-Source: AGHT+IHPiT9T2q/rsjMmlfzLpebaldDEZxUauJ3B5bDrxsLUsRBcRl82MQzUxbC37OavNkgPGv0lwQ== X-Received: by 2002:a05:622a:259b:b0:46e:2d0b:e1bf with SMTP id d75a77b69052e-46fc49a94d2mr79123591cf.11.1738105783629; Tue, 28 Jan 2025 15:09:43 -0800 (PST) X-BeenThere: bitcoindev@googlegroups.com Received: by 2002:a05:622a:a00a:b0:469:63f:ce07 with SMTP id d75a77b69052e-46e5b3e8d30ls31705571cf.0.-pod-prod-00-us; Tue, 28 Jan 2025 15:09:40 -0800 (PST) X-Received: by 2002:a05:620a:2551:b0:7b6:d51b:819a with SMTP id af79cd13be357-7bff3f5c023mr774247085a.5.1738105780494; Tue, 28 Jan 2025 15:09:40 -0800 (PST) Received: by 2002:a05:620a:8220:b0:7b6:67a8:4fcd with SMTP id af79cd13be357-7bffc990de5ms85a; Tue, 28 Jan 2025 14:25:58 -0800 (PST) X-Received: by 2002:a05:6214:2686:b0:6e1:715f:cdf5 with SMTP id 6a1803df08f44-6e243aa4688mr15482436d6.15.1738103157472; Tue, 28 Jan 2025 14:25:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738103157; cv=none; d=google.com; s=arc-20240605; b=XOdcPT91Zk+0h8QFbM9BqsmTWyf/j1R0xgniN/JallGwmm7JFIXTYAlusI16iruql9 i3sufV/uszuX6PhpqAJXisrJPGUrElsS+A4uzjS8WMwRQpZ28nycWmHZ+R5JWez0ECED VEFZcNMk88xn4/Zv8N43RRdtA/jPulvgpv+B/8v179EjB4pLby2eMDXCr3AtkPIHkLGl m07cxOz6jCpRgMbB5AMm394iV6jNKAK+c0r2+H5eTEau4uASbp44GeLjFSnYDX1K45yC nJ8sUZLFWQVH7T6IORFRY463sHVGheqFkYg9+no10axkLnPWh0ZJTOJ2K5yf5AaQlc2e 7PiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-disposition:mime-version:message-id:subject:to:from:date :feedback-id:dkim-signature; bh=gh9B+Vgl1IKwYRN5ZGcVzvWGq8Qt67/ii8w0B3QWymU=; fh=VcGcg+Zjs9gw1uDcHbxsAILhBAcecnbJzZRdxgKVDIc=; b=BhByQsgJaxhrW5dguOucBqDo4V1rBdEewKC6vAwtdgyIhmhInct+mR+KBGIYVKpSjL FDu2gmeqLouNJB86KRHO+aJHffSZgiLMwcetLvVBDo7O9X6UJdtvNAqPX44lSs0fiw6g KQKWCfaJyLNIT3m2LJon+LMNytRzSylmUbzll3F2rpcvNIOHN5eJIPiSdrOvXYkUs2lX QE8Ya3AV/DzMDV9XoK7yHJMwjuJ1hcNLVHOp8/KDxcaNblJebyc0/Xpy7pKE+E3EsHfC xkPf+A4OPBt3K2GmHZSufpMoD4dKtdt9+QPSUz1rlVdlQMKQhDaWJ+HWRhPwIbpSuys/ 6/Iw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TSSCl88W; spf=pass (google.com: domain of pete@petertodd.org designates 202.12.124.156 as permitted sender) smtp.mailfrom=pete@petertodd.org Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com. [202.12.124.156]) by gmr-mx.google.com with ESMTPS id 6a1803df08f44-6e2047b14f4si2972186d6.0.2025.01.28.14.25.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 14:25:57 -0800 (PST) Received-SPF: pass (google.com: domain of pete@petertodd.org designates 202.12.124.156 as permitted sender) client-ip=202.12.124.156; Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id F1BA9254017A for ; Tue, 28 Jan 2025 17:25:56 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Tue, 28 Jan 2025 17:25:57 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuf fkgggtugesghdtreertddtvdenucfhrhhomheprfgvthgvrhcuvfhougguuceophgvthgv sehpvghtvghrthhouggurdhorhhgqeenucggtffrrghtthgvrhhnpeelfeejgefhhfegke ejffeuudelgfdvvedvheejfedtledvffdtheeufeeltefhieenucffohhmrghinhepghhi thhhuhgsrdgtohhmpdhsthgrtghkvghrrdhnvgifshdpphgvthgvrhhtohguugdrohhrgh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvght vgesphgvthgvrhhtohguugdrohhrghdpnhgspghrtghpthhtohepuddpmhhouggvpehsmh htphhouhhtpdhrtghpthhtohepsghithgtohhinhguvghvsehgohhoghhlvghgrhhouhhp shdrtghomh X-ME-Proxy: Feedback-ID: i525146e8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 28 Jan 2025 17:25:56 -0500 (EST) Received: by localhost (Postfix, from userid 1000) id 48D1B9FC5E; Tue, 28 Jan 2025 22:25:55 +0000 (UTC) Date: Tue, 28 Jan 2025 22:25:55 +0000 From: Peter Todd To: bitcoindev@googlegroups.com Subject: [bitcoindev] Transaction expiration should be based on the most recent transaction in a group, not the first Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Hj9tucSajlRuErux" Content-Disposition: inline X-Original-Sender: pete@petertodd.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TSSCl88W; spf=pass (google.com: domain of pete@petertodd.org designates 202.12.124.156 as permitted sender) smtp.mailfrom=pete@petertodd.org Precedence: list Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com List-ID: X-Google-Group-Id: 786775582512 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Score: -0.8 (/) --Hj9tucSajlRuErux Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Disclaimer: I haven't actually tested this. So there is a chance I'm understanding the code entirely wrong. If so, feel free to make fun of me for being too lazy to actually test this. In Bitcoin Core, mempool expiration is done by: int CTxMemPool::Expire(std::chrono::seconds time) { AssertLockHeld(cs); indexed_transaction_set::index::type::iterator it = mapTx.get().begin(); setEntries toremove; while (it != mapTx.get().end() && it->GetTime() < time) { toremove.insert(mapTx.project<0>(it)); it++; } setEntries stage; for (txiter removeit : toremove) { CalculateDescendants(removeit, stage); } RemoveStaged(stage, false, MemPoolRemovalReason::EXPIRY); return stage.size(); } https://github.com/bitcoin/bitcoin/blob/b432e367427f1f9fe0f0a5800e31e496f00cd38d/src/txmempool.cpp#L1086 This function is expiring transactions based on their entry time into the mempool, a value that is set once and never changed. Transactions are removed unconditionally on expiration, whether or not they have descendents. That means that if you broadcast A, wait just prior to A's expiration, and broadcast B, a transaction spending an output of A, B will be evicted immediately when A's expiration time is reached. There's at least three problems with this: 1) It's dumb. If I do a CPFP on an old transaction, I want that transaction to get mined and am willing to pay money. It's silly to make me jump through the hoop of rebroadcasting it again when it expires. 2) It's a free-relay DoS attack: just prior to A expiring, I could broadcast B, a very large transaction, and use up bandwidth for "free". Frankly, I'm not very concerned about this. But if you care, you should fix this. 3) Expiration could maybe be leveraged in transaction cycling attacks: https://stacker.news/items/866680 Personally, I'm not convinced that transaction expiration is actually a good idea. The best argument for it IMO is in the case of some soft-fork-style screwup where you're allowing stuff into your mempool that will never get mined. But that means something is seriously wrong to begin with - you probably should fix that. Otherwise, it's not uncommon for transactions that are months old to eventually get mined. Do we really need to waste bandwidth re-relaying them in the meantime? -- https://petertodd.org 'peter'[:-1]@petertodd.org -- You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/Z5lZc28t9-tCxdHN%40petertodd.org. --Hj9tucSajlRuErux Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE0RcYcKRzsEwFZ3N5Lly11TVRLzcFAmeZWXEACgkQLly11TVR LzehsBAAu8SAEAN65zj5sl7Vi9EX6sVvmFJ1/V3shVXFrajZfkBG8d8l03KT0e2c 23RkOqXyVprOtVuk6IY+o8PsfgMUEQwcjX9bP6FOHCnJzJ5SXUmalZkpDOFA9x8X JIELTB4szMM7OGJ/SWZ2yCcc5RwYz5x/bmlaEjRUS8nZzwqnv2tsIPxorJPnHw6U pfwm6BNqyhzWxGspkL9kkKhlb7x7myozDL9Up5AwiUir71XZh8uQ/Zbx7nfYMFIh QPC3NeJ1j+r3fjo90CkWhyZKm/YExcNg90kBDCvlZp5tOsg+Y4WmmWQTa1NzKyEe 2NOqO2FkL73uV2QExJNXl7P+X513PDffOIuD1ydac6jeR3yQIaqKDCZRw7qmBxev uoHW0cQoVdBrfM9KG8/drYFjGpWI4eR7Hf829fXJwwBNFdatqvg82aa1fZYzMUIs RXm7rfmFYdsmylNYS8OgFUzGtwR1/wdSPCKo6OGWbiWqStiOCu119WynfWVuk3XU YRGFOfOcV05PYFBHJTrQ1qOBKTTYcAmWNZSUxrn8oFp2kEJaQh6KVa1wttZqy8HQ Hutt33nK/IFcaZg4l0eDwijXH4u+7oq0ZEyr3G1BaxFvlRyaa43w1ZcGn6yZvjOd AHfBoGwcCAq9vywF+o3nDlZxR0fss9Tuy24AkEY2h+zcqoUt5+k= =Kx8H -----END PGP SIGNATURE----- --Hj9tucSajlRuErux--