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

Function copyInput

src/simplicity/bitcoin/env.c:40–50  ·  view source on GitHub ↗

Initialize a 'sigInput' from a 'rawBitcoinInput', copying or hashing the data as needed. * * Precondition: NULL != result; * NULL != input; */

Source from the content-addressed store, hash-verified

38 * NULL != input;
39 */
40static void copyInput(sigInput* result, const rawBitcoinInput* input) {
41 *result = (sigInput){ .prevOutpoint = { .ix = input->prevIx }
42 , .sequence = input->sequence
43 , .hasAnnex = !!input->annex
44 };
45
46 if (input->annex) hashBuffer(&result->annexHash, input->annex);
47 sha256_toMidstate(result->prevOutpoint.txid.s, input->prevTxid);
48 copyOutput(&result->txo, &input->txo);
49 hashBuffer(&result->scriptSigHash, &input->scriptSig);
50}
51
52/* Allocate and initialize a 'bitcoinTransaction' from a 'rawBitcoinTransaction', copying or hashing the data as needed.
53 * Returns NULL if malloc fails (or if malloc cannot be called because we require an allocation larger than SIZE_MAX).

Callers 1

Calls 3

sha256_toMidstateFunction · 0.85
hashBufferFunction · 0.70
copyOutputFunction · 0.70

Tested by

no test coverage detected