Skip to content

Commit

Permalink
Add rawtransaction json
Browse files Browse the repository at this point in the history
  • Loading branch information
blondfrogs committed Sep 5, 2023
1 parent f664507 commit 22d0c32
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,22 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
*/

if (tx.nType == FLUXNODE_START_TX_TYPE) {
entry.pushKV("collateral_pubkey", EncodeBase64(tx.collateralPubkey.begin(), tx.collateralPubkey.size()));
entry.pushKV("zelnode_pubkey", EncodeBase64(tx.pubKey.begin(), tx.pubKey.size()));
if (tx.IsFluxnodeUpgradedP2SHTx()) {
entry.pushKV("redeemscript", tx.P2SHRedeemScript.ToString());
if (tx.IsFluxnodeUpgradeTx()) {
entry.pushKV("fluxnode_upgraded_tx_version", tx.nFluxTxVersion);
if (tx.IsFluxnodeUpgradedNormalTx()) {
entry.pushKV("collateral_pubkey", EncodeBase64(tx.collateralPubkey.begin(), tx.collateralPubkey.size()));
}
if (tx.IsFluxnodeUpgradedP2SHTx()) {
entry.pushKV("redeemscript", tx.P2SHRedeemScript.ToString());
}
} else {
// Needed only if not upgraded and not p2sh
entry.pushKV("collateral_pubkey",
EncodeBase64(tx.collateralPubkey.begin(), tx.collateralPubkey.size()));
}
// Always needed
entry.pushKV("zelnode_pubkey", EncodeBase64(tx.pubKey.begin(), tx.pubKey.size()));

}

if (tx.nType == FLUXNODE_CONFIRM_TX_TYPE) {
Expand Down

0 comments on commit 22d0c32

Please sign in to comment.