@@ -151,11 +151,13 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
151151void TxToUniv (const CTransaction& tx, const uint256& hashBlock, UniValue& entry)
152152{
153153 entry.pushKV (" txid" , tx.GetHash ().GetHex ());
154+ entry.pushKV (" hash" , tx.GetWitnessHash ().GetHex ());
154155 entry.pushKV (" version" , tx.nVersion );
155156 entry.pushKV (" locktime" , (int64_t )tx.nLockTime );
156157
157158 UniValue vin (UniValue::VARR);
158- BOOST_FOREACH (const CTxIn& txin, tx.vin ) {
159+ for (unsigned int i = 0 ; i < tx.vin .size (); i++) {
160+ const CTxIn& txin = tx.vin [i];
159161 UniValue in (UniValue::VOBJ);
160162 if (tx.IsCoinBase ())
161163 in.pushKV (" coinbase" , HexStr (txin.scriptSig .begin (), txin.scriptSig .end ()));
@@ -166,6 +168,13 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry)
166168 o.pushKV (" asm" , ScriptToAsmStr (txin.scriptSig , true ));
167169 o.pushKV (" hex" , HexStr (txin.scriptSig .begin (), txin.scriptSig .end ()));
168170 in.pushKV (" scriptSig" , o);
171+ if (!tx.wit .IsNull () && i < tx.wit .vtxinwit .size () && !tx.wit .vtxinwit [i].IsNull ()) {
172+ UniValue txinwitness (UniValue::VARR);
173+ for (const auto & item : tx.wit .vtxinwit [i].scriptWitness .stack ) {
174+ txinwitness.push_back (HexStr (item.begin (), item.end ()));
175+ }
176+ in.pushKV (" txinwitness" , txinwitness);
177+ }
169178 }
170179 in.pushKV (" sequence" , (int64_t )txin.nSequence );
171180 vin.push_back (in);
0 commit comments