Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Jun 1, 2017

Per BIP61, reject code 0x12 for transactions corresponds to "input already spent".

We currently have two internal codes (REJECT_CONFLICT and REJECT_ALREADY_KNOWN) for validation failures for transactions that conflict with the mempool, and are already known repectively.

I think that under a reasonable interpretation of BIP61, those failures actually match "input already spent" and should thus trigger a reject code 0x12.

Implement that.

Reported by @achow101 that some failures did not cause a reject message.

@gmaxwell
Copy link
Contributor

gmaxwell commented Jun 1, 2017

I would rather remove P2P reject codes; they waste bandwidth and AFAIK aren't actually used for anything except perhaps our tests where they are only moderately helpful due to their narrow bandwidth and instability. (if your change doesn't make tests fail, it would further show their lack of use).

@laanwj
Copy link
Member

laanwj commented Jun 1, 2017

Concept ACK

@gmaxwell
I think it would be preferable if you create an issue for removing reject codes, instead of replying that to every PR that changes something to reject code handling.
It's harder to keep track of it if it's all over the place - we had this discussion recently: #10135 (comment)

@jonasschnelli
Copy link
Contributor

utACK 49be502dcc890f5d00930661e7ec926e71489bdb
I guess @achow101 got the rejection code via RPC sendrawtransaction. There it makes sense IMO.

@gmaxwell
Copy link
Contributor

gmaxwell commented Jun 1, 2017

@laanwj fair request, but I really had hoped to avoid having to think about if additional disclosure hurts privacy for a feature that I think we should be backing away from. OK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have added braces on this and the other lines that are being changed to update the style.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@sipa sipa force-pushed the more61duplicate branch from 49be502 to 53fa025 Compare June 1, 2017 21:59
@gmaxwell
Copy link
Contributor

gmaxwell commented Jun 2, 2017

Needs rebase.

@sipa
Copy link
Member Author

sipa commented Jun 2, 2017

Rebased.

@sipa sipa force-pushed the more61duplicate branch from 53fa025 to d9bec88 Compare June 2, 2017 07:19
@TheBlueMatt
Copy link
Contributor

I believe there are a few clients out there that do actually use this crap, at least I recall breadwallet did at some point to identify issues with txn they were sending to peers. Probably should go through a more formal announce/BIP process for these kinds of changes, sadly :(.

@achow101
Copy link
Member

achow101 commented Jun 5, 2017

One thing that this does fix is the fact that a reject message wasn't being sent if a transaction conflicted with another one that was already in the mempool. A reject message should be sent for such a scenario to let the sending peer know that there is a double spend attempt going on. I noticed this while doing some debugging with Armory.

@laanwj
Copy link
Member

laanwj commented Jun 6, 2017

Probably should go through a more formal announce/BIP process for these kinds of changes, sadly :(.

This change, as it is, just adds visible reject messages for cases where the node is silent now. As it is in the spirit of BIP61 I don't think this requires a new BIP. It would be nice to mention in the release notes, though.

@sipa
Copy link
Member Author

sipa commented Jun 6, 2017

@TheBlueMatt The current implementation violates BIP61, in my interpretation.

@achow101
Copy link
Member

achow101 commented Jun 6, 2017

utACK d9bec88

Copy link
Contributor

@dcousens dcousens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck

@TheBlueMatt
Copy link
Contributor

@laanwj Ah, missed that, I withdraw my objection.

utACK d9bec88

@sipa sipa merged commit d9bec88 into bitcoin:master Jun 21, 2017
sipa added a commit that referenced this pull request Jun 21, 2017
d9bec88 Use REJECT_DUPLICATE for already known and conflicted txn (Pieter Wuille)

Tree-SHA512: adc6dc5caed731c3fd5c8784e8820a074e320360cdb5579c5b9299f9799dd99de60b7382d336ab1909dab8b23e744456d78aa0c3b1c8dd1af3d1b779314cf8fa
@sipa sipa deleted the more61duplicate branch June 23, 2017 00:35
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 9, 2019
…icted txn

d9bec88 Use REJECT_DUPLICATE for already known and conflicted txn (Pieter Wuille)

Tree-SHA512: adc6dc5caed731c3fd5c8784e8820a074e320360cdb5579c5b9299f9799dd99de60b7382d336ab1909dab8b23e744456d78aa0c3b1c8dd1af3d1b779314cf8fa
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants