Decode a Simplicity DAG consisting of 'len' nodes from 'stream' into 'dag'. * Returns 'SIMPLICITY_ERR_DATA_OUT_OF_RANGE' if some node's child isn't a reference to one of the preceding nodes. * Returns 'SIMPLICITY_ERR_FAIL_CODE' if the encoding of a fail expression is encountered * (all fail subexpressions ought to have been pruned prior to deserialization). * Returns 'SIMPLICITY_ERR_RESERVED
| 153 | * NULL != stream |
| 154 | */ |
| 155 | static simplicity_err decodeDag(dag_node* dag, simplicity_callback_decodeJet decodeJet, const uint_fast32_t len, combinator_counters* census, bitstream* stream) { |
| 156 | for (uint_fast32_t i = 0; i < len; ++i) { |
| 157 | simplicity_err error = decodeNode(dag, decodeJet, i, stream); |
| 158 | if (!IS_OK(error)) return error; |
| 159 | |
| 160 | enumerator(census, dag[i].tag); |
| 161 | } |
| 162 | return SIMPLICITY_NO_ERROR; |
| 163 | } |
| 164 | |
| 165 | /* Decode a length-prefixed Simplicity DAG from 'stream'. |
| 166 | * Returns 'SIMPLICITY_ERR_DATA_OUT_OF_RANGE' the length prefix's value is too large. |
no test coverage detected