@@ -91,7 +91,8 @@ static struct chain_coin_mvt *new_chain_coin_mvt(const tal_t *ctx,
91
91
enum mvt_tag * tags TAKES ,
92
92
struct amount_msat amount ,
93
93
bool is_credit ,
94
- struct amount_sat output_val )
94
+ struct amount_sat output_val ,
95
+ u32 out_count )
95
96
{
96
97
struct chain_coin_mvt * mvt = tal (ctx , struct chain_coin_mvt );
97
98
@@ -118,7 +119,9 @@ static struct chain_coin_mvt *new_chain_coin_mvt(const tal_t *ctx,
118
119
mvt -> debit = amount ;
119
120
mvt -> credit = AMOUNT_MSAT (0 );
120
121
}
122
+
121
123
mvt -> output_val = output_val ;
124
+ mvt -> output_count = out_count ;
122
125
123
126
return mvt ;
124
127
}
@@ -143,7 +146,7 @@ static struct chain_coin_mvt *new_chain_coin_mvt_sat(const tal_t *ctx,
143
146
blockheight , tags , amt_msat , is_credit ,
144
147
/* All amounts that are sat are
145
148
* on-chain output values */
146
- amt_sat );
149
+ amt_sat , 0 );
147
150
}
148
151
149
152
struct chain_coin_mvt * new_onchaind_withdraw (const tal_t * ctx ,
@@ -178,13 +181,15 @@ struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx,
178
181
const struct bitcoin_outpoint * out ,
179
182
u32 blockheight ,
180
183
const struct amount_msat amount ,
181
- const struct amount_sat output_val )
184
+ const struct amount_sat output_val ,
185
+ u32 output_count )
182
186
{
183
187
return new_chain_coin_mvt (ctx , NULL , txid ,
184
188
out , NULL , blockheight ,
185
189
take (new_tag_arr (NULL , CHANNEL_CLOSE )),
186
190
amount , false,
187
- output_val );
191
+ output_val ,
192
+ output_count );
188
193
}
189
194
190
195
struct chain_coin_mvt * new_coin_channel_open (const tal_t * ctx ,
@@ -200,7 +205,7 @@ struct chain_coin_mvt *new_coin_channel_open(const tal_t *ctx,
200
205
201
206
mvt = new_chain_coin_mvt (ctx , NULL , NULL , out , NULL , blockheight ,
202
207
take (new_tag_arr (NULL , CHANNEL_OPEN )), amount ,
203
- true, output_val );
208
+ true, output_val , 0 );
204
209
mvt -> account_name = type_to_string (mvt , struct channel_id , chan_id );
205
210
206
211
/* If we're the opener, add to the tag list */
@@ -252,7 +257,7 @@ struct chain_coin_mvt *new_coin_external_spend(const tal_t *ctx,
252
257
return new_chain_coin_mvt (ctx , EXTERNAL , txid ,
253
258
outpoint , NULL , blockheight ,
254
259
take (new_tag_arr (NULL , tag )),
255
- AMOUNT_MSAT (0 ), true, amount );
260
+ AMOUNT_MSAT (0 ), true, amount , 0 );
256
261
}
257
262
258
263
struct chain_coin_mvt * new_coin_external_deposit (const tal_t * ctx ,
@@ -334,6 +339,7 @@ struct coin_mvt *finalize_chain_mvt(const tal_t *ctx,
334
339
335
340
mvt -> output_val = tal (mvt , struct amount_sat );
336
341
* mvt -> output_val = chain_mvt -> output_val ;
342
+ mvt -> output_count = chain_mvt -> output_count ;
337
343
mvt -> fees = NULL ;
338
344
339
345
mvt -> timestamp = timestamp ;
@@ -366,6 +372,7 @@ struct coin_mvt *finalize_channel_mvt(const tal_t *ctx,
366
372
mvt -> credit = chan_mvt -> credit ;
367
373
mvt -> debit = chan_mvt -> debit ;
368
374
mvt -> output_val = NULL ;
375
+ mvt -> output_count = 0 ;
369
376
mvt -> fees = tal (mvt , struct amount_msat );
370
377
* mvt -> fees = chan_mvt -> fees ;
371
378
mvt -> timestamp = timestamp ;
@@ -413,6 +420,7 @@ void towire_chain_coin_mvt(u8 **pptr, const struct chain_coin_mvt *mvt)
413
420
towire_amount_msat (pptr , mvt -> credit );
414
421
towire_amount_msat (pptr , mvt -> debit );
415
422
towire_amount_sat (pptr , mvt -> output_val );
423
+ towire_u32 (pptr , mvt -> output_count );
416
424
}
417
425
418
426
void fromwire_chain_coin_mvt (const u8 * * cursor , size_t * max , struct chain_coin_mvt * mvt )
@@ -455,4 +463,5 @@ void fromwire_chain_coin_mvt(const u8 **cursor, size_t *max, struct chain_coin_m
455
463
mvt -> credit = fromwire_amount_msat (cursor , max );
456
464
mvt -> debit = fromwire_amount_msat (cursor , max );
457
465
mvt -> output_val = fromwire_amount_sat (cursor , max );
466
+ mvt -> output_count = fromwire_u32 (cursor , max );
458
467
}
0 commit comments