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

Transaction: WIP, rename internal variables #440

Closed
wants to merge 1 commit into from
Closed

Transaction: WIP, rename internal variables #440

wants to merge 1 commit into from

Conversation

dcousens
Copy link
Contributor

This is just a WIP PR, but it should show case a change I'd like to make to the internals of Transaction.

Assuming most people are using TransacitonBuilder, these changes should be no less disruptive then what has already happened.

This would make the variable naming convention consistent with common-blockchain and most naming conventions for bitcoin transactions.

Open to feedback.

@weilu
Copy link
Contributor

weilu commented Aug 17, 2015

Still a breaking change though as we did not remove Transaction from index export.

@dcousens
Copy link
Contributor Author

No doubt. Added the tag.

@dcousens dcousens added this to the 2.0.0 milestone Aug 18, 2015
@dcousens dcousens assigned weilu and unassigned jprichardson Aug 18, 2015
@dcousens
Copy link
Contributor Author

@weilu are you in favour though?

@weilu
Copy link
Contributor

weilu commented Aug 18, 2015

We already have a lot of breaking changes in 2.0. The argument can go either way based on that. Hell, let's just get it over and done with. Can you promise this is the last one though? ;)

@dcousens
Copy link
Contributor Author

@weilu after #444 and this, the only remaining breaking change is adhering ECPair to #407.

@dcousens dcousens modified the milestones: 2.0.0, 3.0.0 Sep 8, 2015
@dcousens
Copy link
Contributor Author

dcousens commented Sep 9, 2015

Will make this change for 3.0.0, 2.0.0 is disruptive enough.

@dcousens dcousens closed this Sep 9, 2015
@dcousens dcousens deleted the txx branch September 9, 2015 02:40
@dcousens dcousens modified the milestones: 3.0.0, 2.0.0 Sep 14, 2015
@dcousens dcousens restored the txx branch September 14, 2015 06:25
@dcousens dcousens reopened this Sep 14, 2015
@dcousens dcousens mentioned this pull request Nov 30, 2015
@dcousens
Copy link
Contributor Author

dcousens commented Dec 8, 2015

Other thoughts:

block.timestamp -> block.time for consistency with bitcoin/bitcoin RPC.

@weilu
Copy link
Contributor

weilu commented Dec 13, 2015

Quite a bike shed. Just curious, why are we changing bitcoinjs to be consistent with common-blockchain not the other way round? TBH some of our current names make more sense to me (e.g. hash: of course it's the transaction hash since it's the property of transaction inputs', index vs vout: what does v stand for again?)

If we want to be exactly the same as bitcoin/bitcoin RPC, whatevs, doesn't bother me much.

@dcousens
Copy link
Contributor Author

Quite a bike shed. Just curious, why are we changing bitcoinjs to be consistent with common-blockchain not the other way round?

The common-blockchain naming conventions require less context, compared to hash and index, but its more that they had more thought going into their naming during that design than these did (as these are legacy names).
txHash as a convention is asimilar to saying txId for a transaction, instead of just a transactions `id.

s/hash/txHash is probably not worthwhile.
s/index/vout is a very common bitcoin convention and makes reasoning about it very easy. Definitely worthwhile IMHO.

IMHO, I'd be happy if we just went with s/index/vout, s/timestamp/time and s/locktime/nLockTime as the only changes in this PR, if you feel the others are less meaningful.

@dcousens
Copy link
Contributor Author

Though even nLockTime is ambiguous in light of #507. Maybe just lockTime?

@dcousens dcousens mentioned this pull request Apr 1, 2016
@dcousens dcousens assigned fanatid and unassigned weilu Apr 12, 2016
@dcousens
Copy link
Contributor Author

dcousens commented May 9, 2016

@fanatid thoughts on this?

@fanatid
Copy link
Member

fanatid commented May 9, 2016

@dcousens I'd like see names like in bitcoin-core/bitcoin-core rpc/BIPs.

@dcousens
Copy link
Contributor Author

dcousens commented May 10, 2016

@fanatid what were they again? I use custom RPC calls throughout my stack. In any case, they don't have the JSON/Buffer confusion issue that we have to deal with, therefore I don't think it's relevant.
txId is the colloquial name for the reversed-byte-order hash of a transaction, where we use txHash for the regular-byte-order hash.

vout and scriptSig would ~match the RPC IIRC.

@dcousens
Copy link
Contributor Author

block.timestamp -> block.time for consistency with bitcoin/bitcoin RPC.

Seems to have consensus.

vout and nLockTime too.

About it.

@dcousens dcousens closed this Sep 14, 2016
@dcousens dcousens deleted the txx branch September 14, 2016 12:54
@dcousens
Copy link
Contributor Author

The only reasonable changes here would be .vout and maybe block.time.
In terms of a breaking change, I can only see .vout being justifiable just due to how prolific it is and how often I get caught out by it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants