@@ -87,7 +87,9 @@ string dump_pubkey(const struct pubkey *kp)
87
87
string dump_ext_pubkey (const struct ext_key *xp)
88
88
{
89
89
char *out;
90
+ tal_wally_start ();
90
91
int rv = bip32_key_to_base58 (xp, BIP32_FLAG_KEY_PUBLIC, &out);
92
+ tal_wally_end (NULL );
91
93
assert (rv == WALLY_OK);
92
94
string retval (out);
93
95
wally_free_string (out);
@@ -208,29 +210,30 @@ string dump_wally_tx_witness_stack(const struct wally_tx_witness_stack *sp)
208
210
return ostrm.str ();
209
211
}
210
212
211
- string dump_wally_keypath_item (const struct wally_keypath_item *ip)
213
+ string dump_wally_keypath_item (const struct wally_map_item *ip)
212
214
{
215
+ size_t npath = (ip->value_len - BIP32_KEY_FINGERPRINT_LEN) / sizeof (uint32_t );
213
216
ostringstream ostrm;
214
217
ostrm << " { " ;
215
- ostrm << " \" pubkey\" :" << dump_hex (
216
- ip->pubkey , pubkey_is_compressed (ip->pubkey ) ?
217
- EC_PUBLIC_KEY_LEN : EC_PUBLIC_KEY_UNCOMPRESSED_LEN);
218
+ ostrm << " \" pubkey\" :" << dump_hex (ip->key , ip->key_len );
218
219
ostrm << " , \" origin\" :{ " ;
219
- ostrm << " \" fingerprint\" :" << dump_hex (ip-> origin . fingerprint ,
220
- sizeof (ip->origin . fingerprint ) );
220
+ ostrm << " \" fingerprint\" :"
221
+ << dump_hex (ip->value , BIP32_KEY_FINGERPRINT_LEN );
221
222
ostrm << " , \" path\" :[ " ;
222
- for (size_t ii = 0 ; ii < ip-> origin . path_len ; ++ii) {
223
+ for (size_t ii = 0 ; ii < npath ; ++ii) {
223
224
if (ii != 0 )
224
225
ostrm << " ," ;
225
- ostrm << ip->origin .path [ii];
226
+ uint32_t pelem = *(uint32_t *)
227
+ ip->value + BIP32_KEY_FINGERPRINT_LEN + ii * sizeof (uint32_t );
228
+ ostrm << pelem;
226
229
}
227
230
ostrm << " ]" ;
228
231
ostrm << " }" ;
229
232
ostrm << " }" ;
230
233
return ostrm.str ();
231
234
}
232
235
233
- string dump_wally_keypath_map (const struct wally_keypath_map *mp)
236
+ string dump_wally_keypath_map (const struct wally_map *mp)
234
237
{
235
238
ostringstream ostrm;
236
239
ostrm << " [" ;
@@ -245,34 +248,32 @@ string dump_wally_keypath_map(const struct wally_keypath_map *mp)
245
248
return ostrm.str ();
246
249
}
247
250
248
- string dump_wally_partial_sigs_item (const struct wally_partial_sigs_item *ip)
251
+ string dump_wally_signatures_item (const struct wally_map_item *ip)
249
252
{
250
253
ostringstream ostrm;
251
254
ostrm << " { " ;
252
- ostrm << " \" pubkey\" :" << dump_hex (
253
- ip->pubkey , pubkey_is_compressed (ip->pubkey ) ?
254
- EC_PUBLIC_KEY_LEN : EC_PUBLIC_KEY_UNCOMPRESSED_LEN);
255
- ostrm << " , \" sig\" :" << dump_hex (ip->sig , ip->sig_len );
255
+ ostrm << " \" pubkey\" :" << dump_hex (ip->key , ip->key_len );
256
+ ostrm << " , \" sig\" :" << dump_hex (ip->value , ip->value_len );
256
257
ostrm << " }" ;
257
258
return ostrm.str ();
258
259
}
259
260
260
- string dump_wally_partial_sigs_map (const struct wally_partial_sigs_map *mp)
261
+ string dump_wally_signatures_map (const struct wally_map *mp)
261
262
{
262
263
ostringstream ostrm;
263
264
ostrm << " [" ;
264
265
if (mp) {
265
266
for (size_t ii = 0 ; ii < mp->num_items ; ii++) {
266
267
if (ii != 0 )
267
268
ostrm << " ," ;
268
- ostrm << dump_wally_partial_sigs_item (&mp->items [ii]);
269
+ ostrm << dump_wally_signatures_item (&mp->items [ii]);
269
270
}
270
271
}
271
272
ostrm << " ]" ;
272
273
return ostrm.str ();
273
274
}
274
275
275
- string dump_wally_unknowns_item (const struct wally_unknowns_item *ip)
276
+ string dump_wally_unknowns_item (const struct wally_map_item *ip)
276
277
{
277
278
ostringstream ostrm;
278
279
ostrm << " { " ;
@@ -282,7 +283,7 @@ string dump_wally_unknowns_item(const struct wally_unknowns_item *ip)
282
283
return ostrm.str ();
283
284
}
284
285
285
- string dump_wally_unknowns_map (const struct wally_unknowns_map *mp)
286
+ string dump_wally_unknowns_map (const struct wally_map *mp)
286
287
{
287
288
ostringstream ostrm;
288
289
ostrm << " [" ;
@@ -380,21 +381,21 @@ string dump_wally_psbt_input(const struct wally_psbt_input *in)
380
381
{
381
382
ostringstream ostrm;
382
383
ostrm << " { " ;
383
- ostrm << " \" non_witness_utxo \" :" << dump_wally_tx (in->non_witness_utxo );
384
+ ostrm << " \" utxo \" :" << dump_wally_tx (in->utxo );
384
385
ostrm << " , \" witness_utxo\" :" << dump_wally_tx_output (in->witness_utxo );
385
386
ostrm << " , \" redeem_script\" :" << dump_hex (in->redeem_script ,
386
387
in->redeem_script_len );
387
388
ostrm << " , \" witness_script\" :" << dump_hex (in->witness_script ,
388
389
in->witness_script_len );
389
- ostrm << " , \" final_script_sig \" :" << dump_hex (in->final_script_sig ,
390
- in->final_script_sig_len );
390
+ ostrm << " , \" final_scriptsig \" :" << dump_hex (in->final_scriptsig ,
391
+ in->final_scriptsig_len );
391
392
ostrm << " , \" final_witness\" :"
392
393
<< dump_wally_tx_witness_stack (in->final_witness );
393
- ostrm << " , \" keypaths\" :" << dump_wally_keypath_map (in->keypaths );
394
- ostrm << " , \" partial_sigs \" :"
395
- << dump_wally_partial_sigs_map ( in->partial_sigs );
396
- ostrm << " , \" unknowns\" :" << dump_wally_unknowns_map (in->unknowns );
397
- ostrm << " , \" sighash_type \" :" << in->sighash_type ;
394
+ ostrm << " , \" keypaths\" :" << dump_wally_keypath_map (& in->keypaths );
395
+ ostrm << " , \" signatures \" :"
396
+ << dump_wally_signatures_map (& in->signatures );
397
+ ostrm << " , \" unknowns\" :" << dump_wally_unknowns_map (& in->unknowns );
398
+ ostrm << " , \" sighash \" :" << in->sighash ;
398
399
ostrm << " }" ;
399
400
return ostrm.str ();
400
401
}
@@ -421,8 +422,8 @@ string dump_wally_psbt_output(const struct wally_psbt_output *out)
421
422
out->redeem_script_len );
422
423
ostrm << " , \" witness_script\" :" << dump_hex (out->witness_script ,
423
424
out->witness_script_len );
424
- ostrm << " , \" keypaths\" :" << dump_wally_keypath_map (out->keypaths );
425
- ostrm << " , \" unknowns\" :" << dump_wally_unknowns_map (out->unknowns );
425
+ ostrm << " , \" keypaths\" :" << dump_wally_keypath_map (& out->keypaths );
426
+ ostrm << " , \" unknowns\" :" << dump_wally_unknowns_map (& out->unknowns );
426
427
ostrm << " }" ;
427
428
return ostrm.str ();
428
429
@@ -452,7 +453,7 @@ string dump_wally_psbt(const struct wally_psbt *psbt)
452
453
<< dump_wally_psbt_inputs (psbt->inputs , psbt->num_inputs );
453
454
ostrm << " , \" outputs\" :"
454
455
<< dump_wally_psbt_outputs (psbt->outputs , psbt->num_outputs );
455
- ostrm << " , \" unknowns\" :" << dump_wally_unknowns_map (psbt->unknowns );
456
+ ostrm << " , \" unknowns\" :" << dump_wally_unknowns_map (& psbt->unknowns );
456
457
ostrm << " , \" version\" :" << psbt->version ;
457
458
ostrm << " }" ;
458
459
return ostrm.str ();
0 commit comments