Page MenuHomePhabricator

Summary: Replace CAmount typdef with a struct.
AbandonedPublic

Authored by schancel on Aug 26 2017, 23:15.

Details

Reviewers
deadalnix
CCulianu
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Test Plan

Run unit tests.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
implicit-constructor
Lint
Lint Passed
SeverityLocationCodeMessage
Auto-Fixsrc/miner.cpp:1CFMTCode style violation
Auto-Fixsrc/net_processing.cpp:1CFMTCode style violation
Auto-Fixsrc/policy/fees.cpp:1CFMTCode style violation
Auto-Fixsrc/qt/bitcoinamountfield.cpp:1CFMTCode style violation
Auto-Fixsrc/qt/bitcoinamountfield.h:1CFMTCode style violation
Auto-Fixsrc/qt/receiverequestdialog.cpp:1CFMTCode style violation
Auto-Fixsrc/qt/sendcoinsdialog.cpp:1CFMTCode style violation
Auto-Fixsrc/qt/transactiondesc.cpp:1CFMTCode style violation
Auto-Fixsrc/qt/transactionrecord.cpp:1CFMTCode style violation
Auto-Fixsrc/rpc/blockchain.cpp:1CFMTCode style violation
Auto-Fixsrc/script/bitcoinconsensus.cpp:1CFMTCode style violation
Auto-Fixsrc/test/policyestimator_tests.cpp:1CFMTCode style violation
Auto-Fixsrc/txmempool.cpp:1CFMTCode style violation
Auto-Fixsrc/txmempool.h:1CFMTCode style violation
Auto-Fixsrc/validation.cpp:1CFMTCode style violation
Auto-Fixsrc/wallet/rpcwallet.cpp:1CFMTCode style violation
Auto-Fixsrc/wallet/wallet.cpp:1CFMTCode style violation
Unit
No Test Coverage
Build Status
Buildable 770
Build 770: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.Aug 26 2017, 23:15

Fixed a few obvious mistakes (==0 vs !=0)

src/qt/bitcoinamountfield.h
32 ↗(On Diff #1226)

I would like to be able to leave these CAmounts. However, the moc_bitcoinamountfield.cpp that gets generated has errors. I'm not sure what to do about that.

Ok it seems like this very need to be split in chunks. I was able to catch a few errors, but considering how big the thing is, there are probably more. I would proceed as follow :

  1. Get the class working with some unit test that ensure it's behavior is what's expected.
  2. put out a series of diffs that use the new class in various places, one place at the time. This will make errors much more obvious.
  3. Remove the typedef, rename the class CAmount
  4. ...
  5. PROFIT
CCulianu requested changes to this revision.Aug 27 2017, 11:01

Good suggestions by deadalnix.

I should add just to clarify:

  • in the 'interim' phase when you are phasing-in the class, call the class CAmountNew or something and leave the old typedef int64_t CAmount, so old code works.
  • Then one by one replace stuff with CAmountNew -- this is a good strategy to not go nuts as deadalnix suggested.
  • Then at the end we get rid of the old CAmount typedef and rename CAmountNew -> CAmount (including all the usages of it)

Hope this helps..

This revision now requires changes to proceed.Aug 27 2017, 11:01
src/amount.h
47

Holy crap I'm retarded. Let me try this patch again with this fixed.