Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: Extract scriptPubKey on getreceivedbyaddress #16655

Closed
wants to merge 5 commits into from

Conversation

konez2k
Copy link

@konez2k konez2k commented Aug 19, 2019

Update rpc method getreceivedbyaddress to extract the correct scriptPubKey when shifted with opcodes (f.e. OP_CHECKSIG).
getreceivedbylabel is already implemented in the same way.

@maflcko
Copy link
Member

maflcko commented Aug 19, 2019

What is this? refactoring or a bugfix?

@konez2k
Copy link
Author

konez2k commented Aug 19, 2019

bugfix, the expected result from getreceivedbyaddress is different from getreceivedbylabel when the transaction scriptPubKey contains shifted opcodes

@maflcko
Copy link
Member

maflcko commented Aug 19, 2019

Would be nice to include a test that fails before the changes and passes after

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 19, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@konez2k
Copy link
Author

konez2k commented Aug 19, 2019

@MarcoFalke
The issue is mainly with legacy addresses when sending a transaction using address pubkey

@sipa
Copy link
Member

sipa commented Aug 19, 2019

This will make P2PK outputs show up under the address for the corresponding P2PKH. Is that desirable?

@konez2k
Copy link
Author

konez2k commented Aug 19, 2019

@sipa it is under getreceivedbylabel, shouldn't the output be equal between the 2 methods?

@sipa
Copy link
Member

sipa commented Aug 19, 2019

Ah, for consistency that does make sense.

@konez2k
Copy link
Author

konez2k commented Aug 20, 2019

feature_block.py works for me (patch included/excluded), the error is probably due to a timeout on trevis side

Edit: works on appveyor too

],
"hex": "02000000000100ca9a3b00000000232102352974bf0da1e6c4652888f014446572669cf7f9fd54d2c3b3d26ef60f15bd4cac00000000"
}
"""
Copy link
Member

Choose a reason for hiding this comment

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

I think there is no need to copy paste the full output of the command

@fanquake fanquake changed the title RPC: Extract scriptPubKey on getreceivedbyaddress rpc: Extract scriptPubKey on getreceivedbyaddress Aug 21, 2019
@luke-jr
Copy link
Member

luke-jr commented Aug 23, 2019

Concept NACK: p2pk aren't addresses, so this is actually introducing a bug.

Labels are [at least effectively] assigned for both p2pk and p2pkh, which is why there is a discrepancy.

@NicolasDorier
Copy link
Contributor

NicolasDorier commented Aug 26, 2019

Concept NACK for same reason than @luke-jr and same reason as #16725 .

I lost so much time explaining why the genesis transaction output should not appear as an address in block explorers, only to get replied "but why bitcoin core does it?". This in general cause lot's of confusion to new developers and end up in numerous bugs which only happen in production when a malicious actor sends a payment as P2PK to the the same pubkey as the expected P2PKH.

This is worse than a bug, this is a virus, because it spreads a bad practice in the mind of new developers.

Not only this, but P2PK is deprecated, so it does not make sense to add support to something that anyway should not be used anymore.

@meshcollider
Copy link
Contributor

@konez2k thanks for contributing! I think consistency is really valuable, but in this case as the others above have pointed out, it is probably consistency in the wrong direction. Unless anyone else is in support of this, I think its better to close it, but I hope that does not discourage you from contributing more in the future 😄

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants