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

fundrawtransaction #6088

Merged
merged 5 commits into from Jun 23, 2015
Merged

fundrawtransaction #6088

merged 5 commits into from Jun 23, 2015

Conversation

@TheBlueMatt
Copy link
Contributor

TheBlueMatt commented Apr 30, 2015

This superceedes #5503 and #5524. I rewrote chunks of the first and largely rewrote the second, stealing test cases almost verbatim from both.

@sipa
Copy link
Member

sipa commented May 1, 2015

Could we have a DummySignatureCreator, instead of passing a dummy boolean to TransactionSignatureCreator?

@sipa
Copy link
Member

sipa commented May 1, 2015

I had to read the source code to guess what 'fAllowOtherInputs' means. Can you add a comment?

@jonasschnelli
Copy link
Member

jonasschnelli commented May 1, 2015

@sipa: I tried this ("DummySignatorCreator"). But somehow i stopped it because it was getting a inheritance mess. I can't actually remember why exactly.

@sipa
Copy link
Member

sipa commented May 1, 2015

@jonasschnelli Let me hack something up.

@sipa
Copy link
Member

sipa commented May 1, 2015

@jonasschnelli
Copy link
Member

jonasschnelli commented May 1, 2015

@sipa: are you sure this would work also for P2SH Multisig inputs?

@sipa
Copy link
Member

sipa commented May 1, 2015

@jonasschnelli pretty sure, it should.

BaseSignatureCreator is about creating individual (DER+nHashType) signatures, and is called by ProduceSignature wherever necessary. For multisig/P2SH, it will be called multiple times as necessary.

@jonasschnelli
Copy link
Member

jonasschnelli commented May 1, 2015

@sipa: Right. I would do so. To make use of sipa@134090b it would need some adaptation and some changes within SignSignature(). I just tried but had some compiling/casting issues with the DummySignatureChecker class.

But the current solution (as it is in this PR) without a DummySignatorCreator class works well and basically adds only 8 lines of code.
But indeed its not that elegant as sipas proposal.

@sipa
Copy link
Member

sipa commented May 1, 2015

@jgarzik
Copy link
Contributor

jgarzik commented May 2, 2015

Concept ACK - the dummy sig stuff is ugly and poops all over several function/method sigs

@laanwj
Copy link
Member

laanwj commented May 6, 2015

The dummy sig business may be ugly, but it was introduced to avoid even uglier solutions to compute signature sizes: either having parallel byte accounting functioning (lots of duplicate hard-to-crosscheck code), or doing real signing then throwing away the result (requires wallet to be unlocked and is just wrong).

@laanwj laanwj removed this from the 0.11.0 milestone May 18, 2015
@jonasschnelli
Copy link
Member

jonasschnelli commented May 18, 2015

Needs rebase.

@luke-jr
Copy link
Member

luke-jr commented Jun 2, 2015

Dummy sign may be ugly, but it also would enable prompting the user with fee etc prior to passphrase being entered...

"\nAdds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend.\n"
"\nArguments:\n"
"1. \"address\" (string, required) The address\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n"
"3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n"
"4. p2sh (boolean, optional, default=false) Add the P2SH version of the script as well\n"

This comment has been minimized.

Copy link
@luke-jr

luke-jr Jun 2, 2015

Member

This seems nonsensical. What is the use case?

@TheBlueMatt
Copy link
Contributor Author

TheBlueMatt commented Jun 11, 2015

So it turns out the watch-only signing never worked anyway (it used the constant "0" for the public key when calculating size of pay-to-pubkey-hash txn), so I walked that back and watchonly-supporting fundrawtransaction will be a separate pull.

@TheBlueMatt TheBlueMatt force-pushed the TheBlueMatt:frt2 branch 3 times, most recently Jun 11, 2015
@TheBlueMatt TheBlueMatt force-pushed the TheBlueMatt:frt2 branch to 2085895 Jun 11, 2015
@laanwj laanwj merged commit 2085895 into bitcoin:master Jun 23, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
laanwj added a commit that referenced this pull request Jun 23, 2015
2085895 fundrawtransaction tests (Jonas Schnelli)
21bbd92 Add fundrawtransaction RPC method (Matt Corallo)
1e0d1a2 Add FundTransaction method to wallet (Matt Corallo)
2d84e22 Small tweaks to CCoinControl for fundrawtransaction (Matt Corallo)
9b4e7d9 Add DummySignatureCreator which just creates zeroed sigs (Pieter Wuille)
@btcdrak
Copy link
Contributor

btcdrak commented Jun 23, 2015

ACK

@laanwj
Copy link
Member

laanwj commented Jun 24, 2015

Tested ACK (which I forgot to post)

@jonasschnelli
Copy link
Member

jonasschnelli commented Jun 24, 2015

Post merge ACK

if (!CreateTransaction(vecSend, wtx, reservekey, nFeeRet, nChangePosRet, strFailReason, &coinControl, false))
return false;

if (nChangePosRet != -1)

This comment has been minimized.

Copy link
@sipa

sipa Jun 24, 2015

Member

Any reason for trying to guess the changes made by CreateTransaction, and applying those on the original, rather than just using the constructed result?

@sipa
Copy link
Member

sipa commented Jun 24, 2015

Posthumous untested ACK.

@laanwj laanwj mentioned this pull request Feb 10, 2016
@str4d str4d mentioned this pull request Feb 14, 2017
@dagurval dagurval mentioned this pull request Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.