Decode an Bitcoin specific jet name from 'stream' into 'result'. * All jets begin with a bit prefix of '1' which needs to have already been consumed from the 'stream'. * Returns 'SIMPLICITY_ERR_DATA_OUT_OF_RANGE' if the stream's prefix doesn't match any valid code for a jet. * Returns 'SIMPLICITY_ERR_BITSTRING_EOF' if not enough bits are available in the 'stream'. * In the above error cases, '
| 66 | * NULL != stream |
| 67 | */ |
| 68 | static simplicity_err decodePrimitive(jetName* result, bitstream* stream) { |
| 69 | int32_t bit = read1Bit(stream); |
| 70 | if (bit < 0) return (simplicity_err)bit; |
| 71 | if (!bit) { |
| 72 | /* Core jets */ |
| 73 | #include "../decodeCoreJets.inc" |
| 74 | return SIMPLICITY_ERR_DATA_OUT_OF_RANGE; |
| 75 | } else { |
| 76 | /* Bitcoin jets */ |
| 77 | #include "decodeBitcoinJets.inc" |
| 78 | return SIMPLICITY_ERR_DATA_OUT_OF_RANGE; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | /* Return a copy of the Simplicity node corresponding to the given Bitcoin specific jet 'name'. */ |
| 83 | static dag_node jetNode(jetName name) { |
no test coverage detected