OlinCoin
Test
ser_tx.h
1#pragma once
2
3#include "base_tx.h"
4
5#include "constants.h"
6#include "ser_key.h"
7
8/******************************************************************************
9 * UTXOs
10 ******************************************************************************/
11
12#define UTXO_SER_LEN \
13 ( \
14 sizeof(((UTXO*)0)->amt) + \
15 sizeof(((UTXO*)0)->public_key_hash) \
16 )
17
25ssize_t ser_utxo(unsigned char *dest, UTXO *utxo);
26
35unsigned char *ser_utxo_alloc(ssize_t *written, UTXO *utxo);
36
44ssize_t deser_utxo(UTXO *dest, unsigned char *src);
45
53UTXO *deser_utxo_alloc(ssize_t* read, unsigned char *src);
54
55/******************************************************************************
56 * Inputs
57 ******************************************************************************/
58
59#define INPUT_SER_LEN \
60 ( \
61 PUB_KEY_SER_LEN + \
62 sizeof(((Input*)0)->sig_len) + \
63 SIGNATURE_LEN + \
64 TX_HASH_LEN + \
65 sizeof(((Input*)0)->prev_utxo_output) \
66 )
67
75ssize_t ser_input(unsigned char *dest, Input *input);
76
85unsigned char *ser_input_alloc(ssize_t *written, Input *input);
86
94ssize_t deser_input(Input *dest, unsigned char *src);
95
103Input *deser_input_alloc(ssize_t *read, unsigned char *src);
104
105/******************************************************************************
106 * Transactions
107 ******************************************************************************/
108
115size_t size_ser_tx(Transaction *tx);
116
124ssize_t ser_tx(unsigned char *dest, Transaction *tx);
125
134unsigned char *ser_tx_alloc(ssize_t *written, Transaction *tx);
135
143ssize_t deser_tx(Transaction *dest, unsigned char *src);
144
152Transaction* deser_tx_alloc(ssize_t *read, unsigned char *src);
Definition: base_tx.h:11
Definition: base_tx.h:19
Definition: base_tx.h:26