Initialize a 'sigInput' from a 'rawBitcoinInput', copying or hashing the data as needed. * * Precondition: NULL != result; * NULL != input; */
| 38 | * NULL != input; |
| 39 | */ |
| 40 | static 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). |
no test coverage detected