Page MenuHomePhabricator

refactor TxToJSON() and ScriptPubKeyToJSON()
ClosedPublic

Authored by nakihito on Feb 4 2019, 20:12.

Details

Reviewers
jasonbcox
deadalnix
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rSTAGING76c64df03947: refactor TxToJSON() and ScriptPubKeyToJSON()
rABC76c64df03947: refactor TxToJSON() and ScriptPubKeyToJSON()
Summary

This PR removes almost all of the TxToJSON() and ScriptPubKeyToJSON() code from bitcoin-rpc and places it in bitcoin-common, removing about 80 lines of duplicate code. The only part that can't be moved into bitcoin-common is parsing block contextual information (confirmations and blocktime), which are not available to bitcoin-common code.

Backports Core PR8824 https://github.com/bitcoin/bitcoin/pull/8824

Completes T500.

Test Plan

make check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
BackportCorePR8824
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 4873
Build 7809: Bitcoin ABC Buildbot (legacy)
Build 7808: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.Feb 4 2019, 20:12
deadalnix requested changes to this revision.Feb 5 2019, 00:16
deadalnix added inline comments.
src/primitives/transaction.cpp
141

dito

src/primitives/transaction.h
378

This code is related to segwit, remove.

src/rest.cpp
15

Remove

src/rpc/blockchain.cpp
20

Is that still required ?

src/rpc/rawtransaction.cpp
39

Remove this one from the header it's defined in.

This revision now requires changes to proceed.Feb 5 2019, 00:16
nakihito marked an inline comment as done.

Removed segwit code and unnecessary include and function prototype lines.

This revision is now accepted and ready to land.Feb 5 2019, 02:04
This revision was automatically updated to reflect the committed changes.

For posterity, this backport was fubar'd. See D2546 for details.