MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / Serialize

Method Serialize

src/script/interpreter.cpp:1338–1353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1336 /** Serialize txTo */
1337 template<typename S>
1338 void Serialize(S &s) const {
1339 // Serialize version
1340 ::Serialize(s, txTo.version);
1341 // Serialize vin
1342 unsigned int nInputs = fAnyoneCanPay ? 1 : txTo.vin.size();
1343 ::WriteCompactSize(s, nInputs);
1344 for (unsigned int nInput = 0; nInput < nInputs; nInput++)
1345 SerializeInput(s, nInput);
1346 // Serialize vout
1347 unsigned int nOutputs = fHashNone ? 0 : (fHashSingle ? nIn+1 : txTo.vout.size());
1348 ::WriteCompactSize(s, nOutputs);
1349 for (unsigned int nOutput = 0; nOutput < nOutputs; nOutput++)
1350 SerializeOutput(s, nOutput);
1351 // Serialize nLockTime
1352 ::Serialize(s, txTo.nLockTime);
1353 }
1354};
1355
1356/** Compute the (single) SHA256 of the concatenation of all prevouts of a tx. */

Callers

nothing calls this directly

Calls 3

WriteCompactSizeFunction · 0.85
SerializeFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected