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

multi: Change NoSplitTransaction param to SplitTx. #1231

Merged
merged 1 commit into from
May 27, 2018

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented May 27, 2018

The SplitTx parameter for PurchaseTicketCmd specifies the minimum
number of inputs needed to use a split transaction for a ticket
purchase. The parameter options are 1 and 2. Ticket purchase inputs
less than the set SplitTx value are used directly in the transaction.

@dnldd dnldd force-pushed the split_tx branch 2 times, most recently from 532b511 to 52c12e2 Compare May 27, 2018 13:31
@dnldd dnldd changed the title dcrjson: Change NoSplitTransaction param to SplitTx. multi: Change NoSplitTransaction param to SplitTx. May 27, 2018
cmd := dcrjson.NewPurchaseTicketCmd(fromAccount, spendLimit.ToCoin(),
&minConfVal, &ticketAddrStr, &numTicketsVal, &poolAddrStr,
&poolFeesFloat, &expiryVal, nil, noSplitTransaction, &ticketFeeFloat)
&poolFeesFloat, &expiryVal, dcrjson.String(""), &splitTxVal, &ticketFeeFloat)
Copy link
Member

Choose a reason for hiding this comment

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

No need to allocate:

dcrjson.String("") -> nil

Copy link
Member

@chappjc chappjc May 27, 2018

Choose a reason for hiding this comment

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

This was actually a necessary change since the arguments that follow a nil pointer will not be processed. The workaround is to have a non-nil pointer to an empty string.

The SplitTx parameter for PurchaseTicketCmd specifies theminimumnumberof inputs needed to use a split transaction for aticketpurchase. Theparameter options are 1 and 2. Ticket purchaseinputsless than the setSplitTx value are used directly in thetransaction.
@davecgh davecgh merged commit 5ec7a2a into decred:master May 27, 2018
@chappjc
Copy link
Member

chappjc commented May 27, 2018

The nil vs dcrjson.String("") issue came up in the previous PR review: #905 (review)

In general, this seems to be a gotcha that comes up a lot. e.g. decred/dcrrpcclient#89

@davecgh davecgh added this to the 1.3.0 milestone May 28, 2018
@dnldd dnldd deleted the split_tx branch June 4, 2018 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants