Skip to content

Commit 5ed5f6c

Browse files
committed
Wrapped API method parameters w/ typed messages.
1 parent 100e856 commit 5ed5f6c

File tree

3 files changed

+119
-75
lines changed

3 files changed

+119
-75
lines changed

contrib/remote_hsmd/dump.cc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ string dump_secp256k1_ecdsa_recoverable_signature(
6060
return dump_hex(sp->data, sizeof(sp->data));
6161
}
6262

63+
string dump_secret(const struct secret *sp)
64+
{
65+
return dump_hex(sp->data, sizeof(sp->data));
66+
}
67+
6368
string dump_node_id(const struct node_id *pp)
6469
{
6570
return dump_hex(pp->k, sizeof(pp->k));
@@ -70,6 +75,28 @@ string dump_pubkey(const struct pubkey *kp)
7075
return dump_hex(kp->pubkey.data, sizeof(kp->pubkey.data));
7176
}
7277

78+
string dump_witnesses(const u8 ***wp)
79+
{
80+
ostringstream ostrm;
81+
ostrm << "[";
82+
for (size_t input_ndx = 0; input_ndx < tal_count(wp); ++input_ndx) {
83+
if (input_ndx != 0)
84+
ostrm << " ";
85+
ostrm << "[";
86+
u8 const **stack = wp[input_ndx];
87+
for (size_t item_ndx = 0; item_ndx < tal_count(stack);
88+
++item_ndx) {
89+
if (item_ndx != 0)
90+
ostrm << " ";
91+
u8 const *item = stack[item_ndx];
92+
ostrm << dump_hex(item, tal_count(item));
93+
}
94+
ostrm << "]";
95+
}
96+
ostrm << "]";
97+
return ostrm.str();
98+
}
99+
73100
string dump_basepoints(const struct basepoints *bp)
74101
{
75102
ostringstream ostrm;

contrib/remote_hsmd/dump.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ std::string dump_bitcoin_txid(const struct bitcoin_txid *txid);
66
std::string dump_bitcoin_signature(const struct bitcoin_signature *sp);
77
std::string dump_secp256k1_ecdsa_signature(const secp256k1_ecdsa_signature *sp);
88
std::string dump_secp256k1_ecdsa_recoverable_signature(const secp256k1_ecdsa_recoverable_signature *sp);
9+
std::string dump_secret(const struct secret *sp);
910
std::string dump_node_id(const struct node_id *pp);
1011
std::string dump_pubkey(const struct pubkey *kp);
12+
std::string dump_witnesses(const u8 ***wp);
1113
std::string dump_unilateral_close_info(const struct unilateral_close_info *ip);
1214
std::string dump_utxo(const struct utxo *in);
1315
std::string dump_utxos(const struct utxo **utxos);

0 commit comments

Comments
 (0)