-
Notifications
You must be signed in to change notification settings - Fork 128
[FIX] [RPC] Align getrawtransaction with Bitcoin Core #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
moisesPompilio
wants to merge
4
commits into
getfloresta:master
Choose a base branch
from
moisesPompilio:get_raw_transaction
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6e83154
fix(rpc):! correct getrawtransaction method name and standardize verb…
moisesPompilio 0989a01
chore(rpc):! Adjust getrawtransaction to match Bitcoin Core response …
moisesPompilio 11ef8f9
test(integration): add `getrawtransaction` integration test
moisesPompilio 22e29a2
docs(rpc): add documentation for `getrawtransaction` RPC
moisesPompilio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,54 +73,144 @@ impl RescanConfidence { | |
| } | ||
| } | ||
|
|
||
| /// The information returned by a get_raw_tx | ||
| #[derive(Deserialize, Serialize)] | ||
| pub struct RawTxJson { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you tried to use corepc ? |
||
| /// Whether this tx is in our best known chain | ||
| pub in_active_chain: bool, | ||
|
|
||
| /// The hex-encoded tx | ||
| pub hex: String, | ||
|
|
||
| /// The sha256d of the serialized transaction without witness | ||
| pub txid: String, | ||
|
|
||
| /// The sha256d of the serialized transaction including witness | ||
| pub hash: String, | ||
|
|
||
| /// The size this transaction occupies on disk | ||
| pub size: u32, | ||
|
|
||
| /// The virtual size of this transaction, as define by the segwit soft-fork | ||
| pub vsize: u32, | ||
|
|
||
| /// The weight of this transaction, as defined by the segwit soft-fork | ||
| pub weight: u32, | ||
|
|
||
| /// This transaction's version. The current bigger version is 2 | ||
| pub version: u32, | ||
|
|
||
| /// This transaction's locktime | ||
| pub locktime: u32, | ||
|
|
||
| /// A list of inputs being spent by this transaction | ||
| /// | ||
| /// See [TxInJson] for more information about the contents of this | ||
| pub vin: Vec<TxInJson>, | ||
|
|
||
| /// A list of outputs being created by this tx | ||
| /// | ||
| /// See [TxOutJson] for more information | ||
| pub vout: Vec<TxOutJson>, | ||
| pub blockhash: String, | ||
| pub confirmations: u32, | ||
| pub blocktime: u32, | ||
| pub time: u32, | ||
|
|
||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| /// The hash of the block that included this tx, if any | ||
| pub blockhash: Option<String>, | ||
|
|
||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| /// How many blocks have been mined after this transaction's confirmation | ||
| /// including the block that confirms it. A zero value means this tx is unconfirmed | ||
| pub confirmations: Option<u32>, | ||
|
|
||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| /// The timestamp for the block confirming this tx, if confirmed | ||
| pub blocktime: Option<u32>, | ||
|
|
||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| /// Same as blocktime | ||
| pub time: Option<u32>, | ||
| } | ||
|
|
||
| /// A transaction output returned by some RPCs like gettransaction and getblock | ||
| #[derive(Deserialize, Serialize)] | ||
| pub struct TxOutJson { | ||
| pub value: u64, | ||
| /// The amount in btc locked in this UTXO | ||
| pub value: f64, | ||
|
|
||
| /// This utxo's index inside the transaction | ||
| pub n: u32, | ||
|
|
||
| #[serde(rename = "scriptPubKey")] | ||
| /// The locking script of this utxo | ||
| pub script_pub_key: ScriptPubKeyJson, | ||
| } | ||
|
|
||
| /// The locking script inside a txout | ||
| #[derive(Deserialize, Serialize)] | ||
| pub struct ScriptPubKeyJson { | ||
| /// A ASM representation for this script | ||
| /// | ||
| /// Assembly is a high-level representation of a lower level code. Instructions | ||
| /// are turned into OP_XXXXX and data is hex-encoded. | ||
| /// E.g: OP_DUP OP_HASH160 <0000000000000000000000000000000000000000> OP_EQUALVERIFY OP_CHECKSIG | ||
| pub asm: String, | ||
|
|
||
| /// The hex-encoded raw script | ||
| pub hex: String, | ||
| pub req_sigs: u32, | ||
|
|
||
| #[serde(rename = "type")] | ||
| /// The type of this spk. E.g: PKH, SH, WSH, WPKH, TR, non-standard... | ||
| pub type_: String, | ||
| pub address: String, | ||
|
|
||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| /// Encode this script using one of the standard address types, if possible | ||
| pub address: Option<String>, | ||
|
|
||
| #[serde(rename = "desc")] | ||
| /// Inferred descriptor for the output | ||
| pub descriptor: String, | ||
| } | ||
|
|
||
| #[derive(Deserialize, Serialize)] | ||
| /// A transaction input returned by some rpcs, like gettransaction and getblock | ||
| #[derive(Deserialize, Serialize, Default)] | ||
| pub struct TxInJson { | ||
| pub txid: String, | ||
| pub vout: u32, | ||
| pub script_sig: ScriptSigJson, | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| /// The coinbase field is only set for coinbase transactions, and contains the hex-encoded coinbase script | ||
| pub coinbase: Option<String>, | ||
|
|
||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| /// The txid that created this UTXO. Not set for coinbase transactions | ||
| pub txid: Option<String>, | ||
|
|
||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| /// The index of this UTXO inside the tx that created it. Not set for coinbase transactions | ||
| pub vout: Option<u32>, | ||
|
|
||
| #[serde(rename = "scriptSig", skip_serializing_if = "Option::is_none")] | ||
| /// Unlocking script that should solve the challenge and prove ownership over | ||
| /// that UTXO. Not set for coinbase transactions | ||
| pub script_sig: Option<ScriptSigJson>, | ||
|
|
||
| /// The nSequence field, used in relative and absolute lock-times | ||
| pub sequence: u32, | ||
| pub witness: Vec<String>, | ||
|
|
||
| #[serde(rename = "txinwitness", skip_serializing_if = "Option::is_none")] | ||
| /// A vector of witness elements for this input | ||
| pub witness: Option<Vec<String>>, | ||
| } | ||
|
|
||
| /// A representation for the transaction ScriptSig, returned by some rpcs | ||
| /// like gettransaction and getblock | ||
| #[derive(Deserialize, Serialize)] | ||
| pub struct ScriptSigJson { | ||
| /// A ASM representation for this scriptSig | ||
| /// | ||
| /// Assembly is a high-level representation of a lower level code. Instructions | ||
| /// are turned into OP_XXXXX and data is hex-encoded. | ||
| /// E.g: OP_PUSHBYTES32 <000000000000000000000000000000000000000000000000000000000000000000> | ||
| pub asm: String, | ||
|
|
||
| /// The hex-encoded script sig | ||
| pub hex: String, | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think that Bitcoin Core will appear with 4 294 967 295 levels of verbosity