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
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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

nakihito created this revision.Feb 4 2019, 20:12
Owners added a reviewer: Restricted Owners Package.Feb 4 2019, 20:12
Herald added a reviewer: Restricted Project. · View Herald TranscriptFeb 4 2019, 20:12
Herald added a subscriber: schancel. · View Herald Transcript
nakihito removed a subscriber: schancel.
deadalnix requested changes to this revision.Feb 5 2019, 00:16
deadalnix added inline comments.
src/primitives/transaction.cpp
141 ↗(On Diff #7170)

dito

src/primitives/transaction.h
378 ↗(On Diff #7170)

This code is related to segwit, remove.

src/rest.cpp
15 ↗(On Diff #7170)

Remove

src/rpc/blockchain.cpp
20 ↗(On Diff #7170)

Is that still required ?

src/rpc/rawtransaction.cpp
39 ↗(On Diff #7170)

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.Feb 5 2019, 01:22
nakihito updated this revision to Diff 7178.

Removed segwit code and unnecessary include and function prototype lines.

deadalnix accepted this revision.Feb 5 2019, 02:04
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.