@@ -128,6 +128,24 @@ auto main(int argc, char** argv) -> int {
128
128
" to database " ,
129
129
shard_db_dir.str ());
130
130
131
+ auto value = cbdc::commit (secp_context.get (),
132
+ cfg.m_seed_value ,
133
+ {})
134
+ .value ();
135
+ auto range
136
+ = cbdc::transaction::prove (secp_context.get (),
137
+ bulletproof_gens.get (),
138
+ rng,
139
+ {{}, cfg.m_seed_value },
140
+ &value);
141
+ auto value_comm
142
+ = cbdc::serialize_commitment (secp_context.get (),
143
+ value);
144
+
145
+ auto tx = wal.create_seeded_transaction (0 ,
146
+ value_comm,
147
+ range)
148
+ .value ();
131
149
if (!cfg.m_twophase_mode ) {
132
150
leveldb::Options opt;
133
151
opt.create_if_missing = true ;
@@ -150,24 +168,8 @@ auto main(int argc, char** argv) -> int {
150
168
}
151
169
auto batch_size = 0 ;
152
170
leveldb::WriteBatch batch;
153
- auto value = cbdc::commit (secp_context.get (),
154
- cfg.m_seed_value ,
155
- {})
156
- .value ();
157
- auto range
158
- = cbdc::transaction::prove (secp_context.get (),
159
- bulletproof_gens.get (),
160
- rng,
161
- {{}, cfg.m_seed_value },
162
- &value);
163
- auto value_comm
164
- = cbdc::serialize_commitment (secp_context.get (),
165
- value);
166
171
for (size_t tx_idx = 0 ; tx_idx != num_utxos; tx_idx++) {
167
- auto tx = wal.create_seeded_transaction (tx_idx,
168
- value_comm,
169
- range)
170
- .value ();
172
+ tx.m_inputs [0 ].m_prevout .m_index = tx_idx;
171
173
cbdc::transaction::compact_tx ctx (tx);
172
174
const cbdc::hash_t & output_hash
173
175
= cbdc::transaction::calculate_uhs_id (
@@ -215,7 +217,6 @@ auto main(int argc, char** argv) -> int {
215
217
// write dummy size
216
218
auto ser = cbdc::ostream_serializer (out);
217
219
ser << count;
218
- auto tx = wal.create_seeded_transaction (0 ).value ();
219
220
for (size_t tx_idx = 0 ; tx_idx != num_utxos; tx_idx++) {
220
221
tx.m_inputs [0 ].m_prevout .m_index = tx_idx;
221
222
cbdc::transaction::compact_tx ctx (tx);
0 commit comments