MCPcopy Create free account
hub / github.com/ElementsProject/elements / Unserialize

Method Unserialize

src/primitives/transaction.h:207–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205
206 template <typename Stream>
207 inline void Unserialize(Stream& s) {
208 bool fHasAssetIssuance;
209 COutPoint outpoint;
210 s >> outpoint;
211
212 if (!g_con_elementsmode || outpoint.n == (uint32_t) -1) {
213 // No asset issuance for Coinbase inputs.
214 fHasAssetIssuance = false;
215 prevout = outpoint;
216 m_is_pegin = false;
217 } else {
218 // The presence of the asset issuance object is indicated by
219 // a bit set in the outpoint index field.
220 fHasAssetIssuance = !!(outpoint.n & COutPoint::OUTPOINT_ISSUANCE_FLAG);
221 // The interpretation of this input as a peg-in is indicated by
222 // a bit set in the outpoint index field.
223 m_is_pegin = !!(outpoint.n & COutPoint::OUTPOINT_PEGIN_FLAG);
224 // The mode, if set, must be masked out of the outpoint so
225 // that the in-memory index field retains its traditional
226 // meaning of identifying the index into the output array
227 // of the previous transaction.
228 prevout.hash = outpoint.hash;
229 prevout.n = outpoint.n & COutPoint::OUTPOINT_INDEX_MASK;
230 }
231
232 s >> scriptSig;
233 s >> nSequence;
234
235 if (fHasAssetIssuance) {
236 s >> assetIssuance;
237 if (assetIssuance.IsNull()) {
238 throw std::ios_base::failure("Superfluous issuance record");
239 }
240 } else {
241 assetIssuance.SetNull();
242 }
243 }
244
245 friend bool operator==(const CTxIn& a, const CTxIn& b)
246 {

Callers

nothing calls this directly

Calls 2

IsNullMethod · 0.45
SetNullMethod · 0.45

Tested by

no test coverage detected