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: add amount field to TransactionInput #1297

Merged
merged 1 commit into from
Jun 22, 2018

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented Jun 14, 2018

This adds an amount field to TransactionInput intended for specifying the prev out amount when creating a transaction. createraw/ssrtx/sgentx/transaction rpcs are also updated accordingly as well as associated tests.

A typo in assignField was also corrected.

Resolves #1280

@davecgh davecgh added this to the 1.3.0 milestone Jun 16, 2018
rpcserver.go Outdated
prevOut := wire.NewOutPoint(txHash, input.Vout, input.Tree)
txIn := wire.NewTxIn(prevOut, []byte{})
txIn := wire.NewTxIn(prevOut, int64(amt.ToUnit(dcrutil.AmountAtom)), []byte{})
Copy link
Member

Choose a reason for hiding this comment

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

This should be just a type conversion from dcrutil.Amount to int64.

@dnldd dnldd force-pushed the specify_outs branch 4 times, most recently from e1c4191 to 10e71db Compare June 21, 2018 17:03
@dnldd dnldd changed the title multi: require prevout values for createraw/ssrtx/sgentx/transaction. multi: add amount field to TransactionInput Jun 21, 2018
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

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

The JSON-RPC API docs need to be udpated as well.

@dnldd dnldd force-pushed the specify_outs branch 2 times, most recently from d801221 to 6bce7e4 Compare June 21, 2018 21:50
@@ -214,10 +214,10 @@ the method name for further details such as parameter and return information.
| | |
|---|---|
|Method|createrawtransaction|
|Parameters|1. `transaction inputs`: `(JSON array, required)` json array of json objects.<br />`hash`: `(string, required)` the hash of the input.</br> `vout`: (numeric, required) the specific output of the input transaction to redeem transaction.<br /><br />`[{"txid": "hash", "vout": n}, ...]`<br /><br />2. `addresses and amounts`: `(JSON object, required)` - json object with addresses as keys and amounts as values.</br>`address`: `(numeric, required)` the address to send to as the key and the amount in DCR as the value.<br /><br />`{"address": n.nnn, ...}`|
|Parameters|1. `transaction inputs`: `(JSON array, required)` json array of json objects.</br> `amount`: `(numeric)` the previous output amount.<br />`hash`: `(string, required)` the hash of the input.</br> `vout`: (numeric, required) the specific output of the input transaction to redeem transaction.<br /><br />`[{"amount":n, "txid": "hash", "vout": n}, ...]`<br /><br />2. `addresses and amounts`: `(JSON object, required)` - json object with addresses as keys and amounts as values.</br>`address`: `(numeric, required)` the address to send to as the key and the amount in DCR as the value.<br /><br />`{"address": n.nnn, ...}`|
Copy link
Member

Choose a reason for hiding this comment

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

Missing a space before the n in [{"amount":n, "txid": "hash", "vout": n}, ...].

Copy link
Member

Choose a reason for hiding this comment

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

Now that there are two amounts, it should probably specifically call out that the latter amounts are outputs amounts.

Copy link
Member

Choose a reason for hiding this comment

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

Finally, I noticed that the address description is inaccurate. Notice it says:

address: (numeric, required) the address to send to as the key and the amount in DCR as the value.

Which indicates it should literally be the key address. It's not, rather it's actually the address to send the specified amount to.

This adds an amount field to TransactionInput intended for specifying the prev out amount when creating a transaction. createraw/ssrtx/sgentx/transaction rpcs are also updated accordingly as well as associated tests.

A typo in assignField is also corrected.
@davecgh davecgh merged commit 1acb884 into decred:master Jun 22, 2018
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.

3 participants