wallet: expose pocx_type field in transaction RPC responses#5
Open
JohnnyFFM wants to merge 1 commit into
Open
Conversation
Add an optional pocx_type field to listtransactions, gettransaction, and listsinceblock that is set to "assignment" or "revocation" when the transaction carries the corresponding PoCX OP_RETURN marker, and is absent otherwise. The field is pushed inside WalletTxToJSON — the shared helper reached by all three RPCs (directly by gettransaction, and via ListTransactions with fLong=true for the other two) — and declared once in TransactionDescriptionString so the RPCResult documentation flows to every affected RPC. Marker detection short-circuits on the first hit; the assignment / revocation OP_RETURN parsers in pocx/assignments/opcodes.h are reused as-is. Both the include and the field are guarded with #ifdef ENABLE_POCX, matching the convention used elsewhere in src/wallet/. Closes PoC-Consortium/bitcoin-pocx#6. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
pocx_typefield tolisttransactions,gettransaction, andlistsinceblock, set to"assignment"or"revocation"when the transaction carries the corresponding PoCX OP_RETURN marker, and absent otherwise.WalletTxToJSON— the shared helper reached by all three RPCs (directly bygettransaction, viaListTransactionswithfLong=truefor the other two).pocx_typeis declared once inTransactionDescriptionStringso theRPCResultdocumentation flows to every affected RPC.pocx::assignments::IsAssignmentOpReturn/IsRevocationOpReturnparsers are reused.#ifdef ENABLE_POCX, matching the convention used elsewhere insrc/wallet/.Closes PoC-Consortium/bitcoin-pocx#6.
Backwards compatibility
100% additive. No existing field is renamed, removed, or has its meaning changed — assignment txs still appear as
category="send", money-flow accounting and the documentedcategoryenum are untouched. The field is absent (notnull/"") when no marker is present, so for any non-PoCX tx the JSON output is byte-for-byte identical to before. No on-disk / wallet-format change; downgrading the binary just stops emitting the field.Test plan
Manual regtest exercise via the new script in the outer
bitcoin-pocxrepo (scripts/assignments/test-wallet-rpc-pocx-type-v2.sh):pocx_typeabsent ongettransaction,listtransactions,listsinceblockcreate_assignmenttx →pocx_type="assignment"on all three RPCsrevoke_assignmenttx →pocx_type="revocation"on all three RPCsbitcoin_walletandbitcoindbuild cleanTests passed: 18 / 18.