LearnBitcoin

Bitcoin Dev Archive 2015

Can we penalize peers who relay rejected replacement txs?

7 messages, 9 to 10 Jul 2015. Started by Matt Whitlock.

Matt Whitlock (4), Raystonn . (2), Tom Harding

Permalink Original thread on gnusha.org

Matt Whitlock permalink original

I'm presently running my full node with Peter Todd's full replace-by-fee patch set [1]. I am seeing a LOT of messages in the log about replacement transactions being rejected due to their paying less in fees than the transactions they would replace. I understand that this could happen legitimately from time to time, due to my node's receiving a replacing transaction prior to receiving the replaced transaction; however, due to the ongoing spam attack, I am seeing a steady stream of these rejection messages, dozens per second at times. I am wondering if each replacement rejection ought to penalize the peer who relayed the offending transaction, and if the penalty builds up enough, then the peer could be temporarily banned, similar to how other "misbehaving" peers are treated.

[1] https://github.com/petertodd/bitcoin/commits/replace-by-fee-v0.10.2
Raystonn . in reply to Matt Whitlock permalink original

It is a mistake for RBF to assume a transaction with lower fee is invalid.  If I paid a higher fee to get a one hour confirmation in the current congestion, I might want to drop back to a lower fee if I see the spam stop.

On 9 Jul 2015 4:55 pm, Matt Whitlock <bip@mattwhitlock•name> wrote:

I'm presently running my full node with Peter Todd's full replace-by-fee patch set [1]. I am seeing a LOT of messages in the log about replacement transactions being rejected due to their paying less in fees than the transactions they would replace. I understand that this could happen legitimately from time to time, due to my node's receiving a replacing transaction prior to receiving the replaced transaction; however, due to the ongoing spam attack, I am seeing a steady stream of these rejection messages, dozens per second at times. I am wondering if each replacement rejection ought to penalize the peer who relayed the offending transaction, and if the penalty builds up enough, then the peer could be temporarily banned, similar to how other "misbehaving" peers are treated.

[1] https://github.com/petertodd/bitcoin/commits/replace-by-fee-v0.10.2
Matt Whitlock in reply to Raystonn . permalink original

Um, it's called "replace-by-fee" for a reason. The transaction [set] paying the highest fee [rate] is always the one that will be accepted. You can't use the order in which transactions were received to determine which one is the "replacing" transaction and which is/are the "replaced" transaction(s) because order is not defined for transactions in the mempool. (Ordering transactions is precisely why we must have a block chain.)

On Thursday, 9 July 2015, at 5:42 pm, Raystonn wrote:

Quoted text (6 lines)
> It is a mistake for RBF to assume a transaction with lower fee is invalid.  If I paid a higher fee to get a one hour confirmation in the current congestion, I might want to drop back to a lower fee if I see the spam stop.
>
> On 9 Jul 2015 4:55 pm, Matt Whitlock <bip@mattwhitlock•name> wrote:
> > I'm presently running my full node with Peter Todd's full replace-by-fee patch set [1]. I am seeing a LOT of messages in the log about replacement transactions being rejected due to their paying less in fees than the transactions they would replace. I understand that this could happen legitimately from time to time, due to my node's receiving a replacing transaction prior to receiving the replaced transaction; however, due to the ongoing spam attack, I am seeing a steady stream of these rejection messages, dozens per second at times. I am wondering if each replacement rejection ought to penalize the peer who relayed the offending transaction, and if the penalty builds up enough, then the peer could be temporarily banned, similar to how other "misbehaving" peers are treated.
> >
> > [1] https://github.com/petertodd/bitcoin/commits/replace-by-fee-v0.10.2
Raystonn . in reply to Matt Whitlock permalink original

Yes, I understand how it works.  The concept is flawed because it favors greater fees rather than being something more balanced.  It means fees can quickly jump up in response to an upward slope in mempool size, but they will not quickly drop in response to a downward slope of the same.

On 9 Jul 2015 6:12 pm, Matt Whitlock <bip@mattwhitlock•name> wrote:

Um, it's called "replace-by-fee" for a reason. The transaction [set] paying the highest fee [rate] is always the one that will be accepted. You can't use the order in which transactions were received to determine which one is the "replacing" transaction and which is/are the "replaced" transaction(s) because order is not defined for transactions in the mempool. (Ordering transactions is precisely why we must have a block chain.)

On Thursday, 9 July 2015, at 5:42 pm, Raystonn wrote:

Quoted text (6 lines)
> It is a mistake for RBF to assume a transaction with lower fee is invalid.  If I paid a higher fee to get a one hour confirmation in the current congestion, I might want to drop back to a lower fee if I see the spam stop.

>

> On 9 Jul 2015 4:55 pm, Matt Whitlock <bip@mattwhitlock•name> wrote:

> > I'm presently running my full node with Peter Todd's full replace-by-fee patch set [1]. I am seeing a LOT of messages in the log about replacement transactions being rejected due to their paying less in fees than the transactions they would replace. I understand that this could happen legitimately from time to time, due to my node's receiving a replacing transaction prior to receiving the replaced transaction; however, due to the ongoing spam attack, I am seeing a steady stream of these rejection messages, dozens per second at times. I am wondering if each replacement rejection ought to penalize the peer who relayed the offending transaction, and if the penalty builds up enough, then the peer could be temporarily banned, similar to how other "misbehaving" peers are treated.

> >

> > [1] https://github.com/petertodd/bitcoin/commits/replace-by-fee-v0.10.2
Matt Whitlock in reply to Matt Whitlock permalink original

My reasons for wanting this are two-fold:

1.) To reduce the CPU load due to Bitcoind. Presently I am seeing periods of time in which Bitcoind is pegging a CPU core. Given that the flood of spam transactions appears mostly to be invalid under RBF rules, I would like to cut off the flood coming into my node by temp-banning the peers who are relaying invalid replacement transactions.

2.) If enough other nodes also implement this banning rule, then we could potentially cut off the flood of spam right at the source. Then the spammer would be forced to build and publish *non-conflicting* transactions to continue the attack, and this would be much costlier to maintain, as then *all* of the spam transactions could eventually have their fees collected by miners, not just some non-conflicting subset of the spam.

On Thursday, 9 July 2015, at 6:27 pm, Patrick Strateman wrote:

Quoted text (19 lines)
> What do you gain by banning peers doing this?
>
> I'm thinking practically nothing.
>
> On Jul 9, 2015 4:55 PM, "Matt Whitlock" <bip@mattwhitlock•name> wrote:
>
> > I'm presently running my full node with Peter Todd's full replace-by-fee
> > patch set [1]. I am seeing a LOT of messages in the log about replacement
> > transactions being rejected due to their paying less in fees than the
> > transactions they would replace. I understand that this could happen
> > legitimately from time to time, due to my node's receiving a replacing
> > transaction prior to receiving the replaced transaction; however, due to
> > the ongoing spam attack, I am seeing a steady stream of these rejection
> > messages, dozens per second at times. I am wondering if each replacement
> > rejection ought to penalize the peer who relayed the offending transaction,
> > and if the penalty builds up enough, then the peer could be temporarily
> > banned, similar to how other "misbehaving" peers are treated.
> >
> > [1] https://github.com/petertodd/bitcoin/commits/replace-by-fee-v0.10.2
Tom Harding in reply to Matt Whitlock permalink original

Replace-by-anything can only work if conflicts are relayed, so the solution is not to act against the peer.

Alex Morcos offered a suggestion on IRC -- track recently-rejected txid's and don't getdata them. The idea sounds good to me.

On 7/9/2015 4:55 PM, Matt Whitlock wrote:

Quoted text (7 lines)
> I'm presently running my full node with Peter Todd's full replace-by-fee patch set [1]. I am seeing a LOT of messages in the log about replacement transactions being rejected due to their paying less in fees than the transactions they would replace. I understand that this could happen legitimately from time to time, due to my node's receiving a replacing transaction prior to receiving the replaced transaction; however, due to the ongoing spam attack, I am seeing a steady stream of these rejection messages, dozens per second at times. I am wondering if each replacement rejection ought to penalize the peer who relayed the offending transaction, and if the penalty builds up enough, then the peer could be temporarily banned, similar to how other "misbehaving" peers are treated.
>
> [1] https://github.com/petertodd/bitcoin/commits/replace-by-fee-v0.10.2
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
Matt Whitlock in reply to Tom Harding permalink original

On Thursday, 9 July 2015, at 6:57 pm, Tom Harding wrote:

Quoted text (5 lines)
> Replace-by-anything can only work if conflicts are relayed, so the
> solution is not to act against the peer.
>
> Alex Morcos offered a suggestion on IRC -- track recently-rejected
> txid's and don't getdata them.  The idea sounds good to me.

While that's probably a good idea, it wouldn't do much to reduce the load. I am not seeing many repeated transaction hashes among the "rejected replacement" messages in my log.