Skip to content

Conversation

@jnewbery
Copy link
Contributor

Based on #14565. Please don't review this until that PR is merged.

Fixes review comments from @ryanofsky here: #14886 (review)

sipa and others added 4 commits December 12, 2018 16:32
This introduces various changes to the importmulti logic:
* Instead of processing input and importing things at the same time, first
  process all input data and verify it, so no changes are made in case of
  an error.
* Verify that no superfluous information is provided (no keys or scripts
  that don't contribute to solvability in particular).
* Add way more sanity checks, by means of descending into all involved
  scripts.
Fixes review comments from PR 14886.
Adds a new wallet_util.py module and moves generic helper functions
there:

- get_key
- get_multisig
- test_address
@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 13, 2018

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #15032 (Nit fixes for PR 14565 by MeshCollider)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

---------------------

The `importmulti` RPC will now contain a new per-request `warnings` field with strings
that explain when fields are being ignored or inconsistant, if any.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be "inconsistent" :-)

result = self.nodes[1].importmulti([req])
observed_warnings = []
if 'warnings' in result[0]:
observed_warnings = result[0]['warnings']
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation is not a multiple of four :-)

script_to_p2sh_p2wsh(script_code)) # p2sh-p2wsh addr

def test_importmulti(self, req, success, error_code=None, error_message=None):
def test_importmulti(self, req, success, error_code=None, error_message=None, warnings=[]):
Copy link
Contributor

@practicalswift practicalswift Dec 14, 2018

Choose a reason for hiding this comment

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

I suggest using warnings=None instead to clarify that warnings is not meant to be remembered across calls.

Background:

>>> def test(i, i_arr=[]):
...     i_arr.append(i)
...     return i_arr
...
>>> test(1)
[1]
>>> test(2)
[1, 2]
>>> test(3)
[1, 2, 3]

Suggested alternative:

>>> def test(i, i_arr=None):
...     if i_arr is None:
...         i_arr=[]
...     i_arr.append(i)
...     return i_arr
...
>>> test(1)
[1]
>>> test(2)
[2]
>>> test(3)
[3]

@jnewbery
Copy link
Contributor Author

jnewbery commented Dec 14, 2018

@practicalswift - please see the PR text:

Based on #14565. Please don't review this until that PR is merged.

All of your review comments above are for commits in #14565.

@Sjors
Copy link
Member

Sjors commented Dec 15, 2018

Meanwhile, concept ACK on wallet_util.py

@maflcko
Copy link
Member

maflcko commented Jan 5, 2019

Picked up in #15108

@maflcko maflcko closed this Jan 5, 2019
@jnewbery
Copy link
Contributor Author

jnewbery commented Jan 5, 2019

@amitiuttarwar has offered to pick this up in #15108. Reviewers, please leave review comments there.

@jnewbery jnewbery deleted the 14886_review_comments branch January 5, 2019 12:11
maflcko pushed a commit that referenced this pull request Jan 9, 2019
2d5f1ea [tests] move wallet util functions to wallet_util.py (John Newbery)
6be64ef [tests] tidy up wallet_importmulti.py (John Newbery)

Pull request description:

  Cherry picks un-merged commits from #14952, which "fixes review comments from @ryanofsky here: #14886 (review)"

Tree-SHA512: 5f389196b0140d013a533d500f1812786a3a5cfb65980e13eaeacc459fddb55f43d05da3ab5e7cc8c997f26c0b667eed081ab6de2d125e631c70a7dd4c06e350
@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.

7 participants