Replaces CTransaction::IsCoinbase() with the same cheap check as: https://github.com/bitcoin/bitcoin/blob/76e2cded477bc483ec610212bdadf21fe35292d4/src/validation.cpp#L2048
Remove unnecessary call to CTransaction::IsCoinBase() #16103
pull promag wants to merge 1 commits into bitcoin:master from promag:2015-05-avoid-iscoinbase changing 1 files +2 −2-
promag commented at 3:38 PM on May 27, 2019: member
-
Remove unnecessary call to CTransaction::IsCoinBase() c4ccf55ad6
- fanquake added the label Refactoring on May 27, 2019
- fanquake added the label Validation on May 27, 2019
-
promag commented at 3:39 PM on May 27, 2019: member
Am I missing something? Is there a case where this change is wrong?
-
Empact commented at 7:52 PM on May 27, 2019: member
-0 IMO better to rely on the definition in
IsCoinBase. I think the line you cite may be for coherence with https://github.com/bitcoin/bitcoin/blob/76e2cded477bc483ec610212bdadf21fe35292d4/src/validation.cpp#L1973 -
practicalswift commented at 7:16 AM on May 29, 2019: contributor
@promag I think this change makes the code less clear for new contributors who might not be aware of the fact that the first transaction must be a coinbase transaction. If the rationale is performance: the call to
IsCoinBase()should be essentially free, no? :-) -
mzumsande commented at 12:47 PM on May 29, 2019: member
For me as a new contributor, the fact that there is currently a mix (lines 2048 and 2051 use
i) is more confusing. If we don't want to rely oni>0in spite of having calledCheckBlock()at the beginning ofConnectBlock(), why not useIsCoinBase()consistently (maybe call only once per tx and store in local bool for performance). -
promag commented at 1:05 PM on May 29, 2019: member
PR timeout.
- promag closed this on May 29, 2019
- promag deleted the branch on May 29, 2019
- MarcoFalke locked this on Dec 16, 2021