Skip to content

Commit 22d0c32

Browse files
committed
Add rawtransaction json
1 parent f664507 commit 22d0c32

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,22 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
175175
*/
176176

177177
if (tx.nType == FLUXNODE_START_TX_TYPE) {
178-
entry.pushKV("collateral_pubkey", EncodeBase64(tx.collateralPubkey.begin(), tx.collateralPubkey.size()));
179-
entry.pushKV("zelnode_pubkey", EncodeBase64(tx.pubKey.begin(), tx.pubKey.size()));
180-
if (tx.IsFluxnodeUpgradedP2SHTx()) {
181-
entry.pushKV("redeemscript", tx.P2SHRedeemScript.ToString());
178+
if (tx.IsFluxnodeUpgradeTx()) {
179+
entry.pushKV("fluxnode_upgraded_tx_version", tx.nFluxTxVersion);
180+
if (tx.IsFluxnodeUpgradedNormalTx()) {
181+
entry.pushKV("collateral_pubkey", EncodeBase64(tx.collateralPubkey.begin(), tx.collateralPubkey.size()));
182+
}
183+
if (tx.IsFluxnodeUpgradedP2SHTx()) {
184+
entry.pushKV("redeemscript", tx.P2SHRedeemScript.ToString());
185+
}
186+
} else {
187+
// Needed only if not upgraded and not p2sh
188+
entry.pushKV("collateral_pubkey",
189+
EncodeBase64(tx.collateralPubkey.begin(), tx.collateralPubkey.size()));
182190
}
191+
// Always needed
192+
entry.pushKV("zelnode_pubkey", EncodeBase64(tx.pubKey.begin(), tx.pubKey.size()));
193+
183194
}
184195

185196
if (tx.nType == FLUXNODE_CONFIRM_TX_TYPE) {

0 commit comments

Comments
 (0)