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

IsMine: Set state to WATCH_ONLY if we can get the pubkey #17374

Closed
wants to merge 1 commit into from

Conversation

achow101
Copy link
Member

@achow101 achow101 commented Nov 4, 2019

This fixes a logic bug in watch only detection.

Split from #17261

This fixes a logic bug in watch only detection.
@Sjors
Copy link
Member

Sjors commented Nov 5, 2019

ACK 9972b28, trusting my previous self here, I remember understanding what this did :-) #16341 (comment)

@maflcko
Copy link
Member

maflcko commented Nov 5, 2019

When was this bug introduced? Does it need backport? Would a regression test be appropriate?

@achow101
Copy link
Member Author

achow101 commented Nov 5, 2019

Looking at this much more closely, I'm not entirely sure that this is really a bug fix or whether it is needed.

The reason this was included in the ScriptPubKeyMan PR was that because IsMine is relied upon more heavily in the ScriptPubKeyMan model, wallet_importmulti.py was failing. It failed in the specific case where a legacy address was fetched, and from its information, a wpkh() descriptor (so an output type that does not match the address) was imported into another wallet. Then getaddressinfo was called using the original legacy address but on the imported wallet and it failed to find any information. This change was introduced to make the test pass, but perhaps it would have been better to change the test to be consistent with the address types.

Furthermore, the wallet with the import does not recognize the legacy address as being watch only. getaddressinfo reports it as not watch only and coins sent to that address are not detected by the wallet. This PR would change that, furthering the "any pubkey we have" behavior of the ismine, which I don't think is actually desirable. But, at the same time, the current behavior is that we are able to get metadata about the legacy address (we return the pubkey and key origin info). After the rest of the ScriptPubKeyMan refactor, this would no longer be true; getaddressinfo will not return any information about the legacy address and treat it as any other third party address unrelated to the wallet even though we have the pubkey.

And lastly, the current behavior is that we do have this weird state where the legacy address is not watch only but is solvable. So we could add key origin information to a PSBT which has inputs spending from this address but the wallet wouldn't be tracking that address. ScriptPubKeyMan does change that behavior too (due to checking IsMine).

@instagibbs
Copy link
Member

this might not be worth fixing. AFAIK it was only introduced with descriptor import, but the behavior was never a regression as such.

@Sjors
Copy link
Member

Sjors commented Nov 6, 2019

Paging @sipa.

meshcollider added a commit that referenced this pull request Nov 22, 2019
…eing imported

b84e776 wallet_importmulti: use addresses of the same type as being imported (Andrew Chow)

Pull request description:

  When constructing an import from the solving data of an address, make sure that the original address is the same type as the one that will be imported.

  See also: #17374 (comment)

  Part of #17261

ACKs for top commit:
  Sjors:
    Code review ACK b84e776
  meshcollider:
    Tested re-ACK b84e776

Tree-SHA512: 53c49c63af8cbade0116a62beddc77df1a411d8ed76571c3053f6aff096f41a5325421a188bab3dcacfda69bb28fdff6ba921ddd80f29c4abbadb3b58fda884c
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 22, 2019
…pe as being imported

b84e776 wallet_importmulti: use addresses of the same type as being imported (Andrew Chow)

Pull request description:

  When constructing an import from the solving data of an address, make sure that the original address is the same type as the one that will be imported.

  See also: bitcoin#17374 (comment)

  Part of bitcoin#17261

ACKs for top commit:
  Sjors:
    Code review ACK b84e776
  meshcollider:
    Tested re-ACK b84e776

Tree-SHA512: 53c49c63af8cbade0116a62beddc77df1a411d8ed76571c3053f6aff096f41a5325421a188bab3dcacfda69bb28fdff6ba921ddd80f29c4abbadb3b58fda884c
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
…pe as being imported

b84e776 wallet_importmulti: use addresses of the same type as being imported (Andrew Chow)

Pull request description:

  When constructing an import from the solving data of an address, make sure that the original address is the same type as the one that will be imported.

  See also: bitcoin#17374 (comment)

  Part of bitcoin#17261

ACKs for top commit:
  Sjors:
    Code review ACK b84e776
  meshcollider:
    Tested re-ACK b84e776

Tree-SHA512: 53c49c63af8cbade0116a62beddc77df1a411d8ed76571c3053f6aff096f41a5325421a188bab3dcacfda69bb28fdff6ba921ddd80f29c4abbadb3b58fda884c
@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.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants