Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Jun 6, 2016

No description provided.

@luke-jr
Copy link
Member

luke-jr commented Jun 6, 2016

Should actually be BTC (or satoshis?) per byte, since we no longer do it per kB...

@sipa
Copy link
Member

sipa commented Jun 6, 2016

All RPC arguments use BTC/kByte, no?

@jonasschnelli
Copy link
Contributor

It should be the same format than bitcoind spit out when one calls estimatefee.

@maflcko
Copy link
Member Author

maflcko commented Jun 6, 2016

@jonasschnelli et al: Added a commit so I don't have to modify the univalue subtree. (Added a UniValueType wrapper instead)

Copy link
Member

Choose a reason for hiding this comment

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

nit s/sat/set

Copy link
Contributor

Choose a reason for hiding this comment

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

it is probably satoshis. But not very clear, yes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, will fix the comment.

@laanwj
Copy link
Member

laanwj commented Jun 7, 2016

BTC/kB is fine, we use that for fee rates on the interface everywhere. The point of this change is to reduce the variety of different ways in which the same is expressed on the interface, not come up with something new.

utACK faf82e8

@maflcko maflcko force-pushed the Mf1606-univalAny branch from a9a64df to 7817d3f Compare June 7, 2016 07:03
@maflcko
Copy link
Member Author

maflcko commented Jun 7, 2016

I think @luke-jr was referring to kB no longer being the smallest unit. Currently we use Byte to be the smallest unit.

Copy link
Member

Choose a reason for hiding this comment

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

Looks muc hbetter in c++11 syntax

@maflcko maflcko force-pushed the Mf1606-univalAny branch from 7817d3f to fab3629 Compare June 7, 2016 07:16
@maflcko
Copy link
Member Author

maflcko commented Jun 7, 2016

(Force pushed after fixing comment-nit)

@jonasschnelli
Copy link
Contributor

Not sure if I got this right, but why not just removing the "feeRate" from the RPCTypeCheckObj check (it's optional anyways)? I don't see the reason for the new UniValueType type.

@maflcko
Copy link
Member Author

maflcko commented Jun 7, 2016

We also want to suppress passing in unrecognized parameters. (Try removing it and see where the rpc tests fail. Hint: fStrict is set to true)

@jonasschnelli
Copy link
Contributor

Ah. Right. Makes sense.
Is there no way to avoid the UniValueType wrapper? Using UniValue::VNULL for a type-independent check? Or would a C++11 union be simpler?

src/rpc/server.h Outdated
Copy link
Member

Choose a reason for hiding this comment

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

typedef is not needed for structs and classes in C++.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Also changed to union as suggested by @jonasschnelli

@maflcko maflcko force-pushed the Mf1606-univalAny branch from fab3629 to fa51551 Compare June 7, 2016 09:59
@jonasschnelli
Copy link
Contributor

Nice!
utACK fa51551b7f5c2dbfae01f5cee8ee8251868609e2

Copy link
Member

Choose a reason for hiding this comment

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

This is not valid. You can only access fields of a union that you know was the last one assigned to. Testing both typeAny and type certains violates that property at least once.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I should probably just do s/union/struct/ to revert to struct.

Copy link
Member

Choose a reason for hiding this comment

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

I agree. It's very easy to violate the requirements of using an union accidentally, resulting in horrible hard to debug issues, I'd prefer not using them unless it's a place where the additional memory usage is critical. I don't think that's the case here.

Copy link
Member Author

Choose a reason for hiding this comment

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

done. Hope I got it right this time. 👍

Also introduce UniValueType

UniValueType is a wrapper for UniValue::VType which allows setting
a typeAny flag. This flag indicates the type does not matter.

(Used by RPCTypeCheckObj)
@maflcko maflcko force-pushed the Mf1606-univalAny branch from fa51551 to fa7f4f5 Compare June 7, 2016 11:13

if (options.exists("feeRate"))
{
feeRate = CFeeRate(options["feeRate"].get_real());
Copy link
Member

Choose a reason for hiding this comment

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

We slipped up with the review for #7967, shouldn't have allowed using get_real here. Good that this is being replaced.

Copy link
Member Author

Choose a reason for hiding this comment

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

On the other hand, imagine if someone noticed it while reviewing #7967: The pull probably would have never made it into 0.13 before feature freeze, because adding the anytype is a non-trivial refactor and review is hard to do when there is substantial refactoring going on while adding new features.

Looking at it from this perspective, it makes sense to have two pulls to aid review.

Copy link
Member

Choose a reason for hiding this comment

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

I agree

@laanwj laanwj merged commit fa7f4f5 into bitcoin:master Jun 8, 2016
laanwj added a commit that referenced this pull request Jun 8, 2016
fa7f4f5 [rpc] fundrawtransaction feeRate: Use BTC/kB (MarcoFalke)
faf82e8 [rpc] fundrawtransaction: Fix help text and interface (MarcoFalke)
@laanwj
Copy link
Member

laanwj commented Jun 8, 2016

utACK fa7f4f5

@laanwj laanwj mentioned this pull request Jun 8, 2016
16 tasks
@maflcko maflcko deleted the Mf1606-univalAny branch June 8, 2016 12:18
codablock pushed a commit to codablock/dash that referenced this pull request Dec 22, 2017
fa7f4f5 [rpc] fundrawtransaction feeRate: Use BTC/kB (MarcoFalke)
faf82e8 [rpc] fundrawtransaction: Fix help text and interface (MarcoFalke)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
fa7f4f5 [rpc] fundrawtransaction feeRate: Use BTC/kB (MarcoFalke)
faf82e8 [rpc] fundrawtransaction: Fix help text and interface (MarcoFalke)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 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