mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-26 20:30:59 +01:00
channeld: pass in HSM_FD as an argument to watchtower code.
It's weird to reproduce this #define in another file. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
e9cd84f490
commit
66fb7d6026
3 changed files with 8 additions and 6 deletions
|
@ -1416,7 +1416,8 @@ static u8 *got_revoke_msg(struct peer *peer, u64 revoke_num,
|
||||||
ptx = penalty_tx_create(
|
ptx = penalty_tx_create(
|
||||||
NULL, peer->channel, peer->feerate_penalty,
|
NULL, peer->channel, peer->feerate_penalty,
|
||||||
peer->final_scriptpubkey, per_commitment_secret,
|
peer->final_scriptpubkey, per_commitment_secret,
|
||||||
&pbase->txid, pbase->outnum, pbase->amount);
|
&pbase->txid, pbase->outnum, pbase->amount,
|
||||||
|
HSM_FD);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = towire_channel_got_revoke(peer, revoke_num, per_commitment_secret,
|
msg = towire_channel_got_revoke(peer, revoke_num, per_commitment_secret,
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
static const u8 ONE = 0x1;
|
static const u8 ONE = 0x1;
|
||||||
#define HSM_FD 6
|
|
||||||
|
|
||||||
const struct bitcoin_tx *
|
const struct bitcoin_tx *
|
||||||
penalty_tx_create(const tal_t *ctx,
|
penalty_tx_create(const tal_t *ctx,
|
||||||
|
@ -22,7 +21,8 @@ penalty_tx_create(const tal_t *ctx,
|
||||||
u8 *final_scriptpubkey,
|
u8 *final_scriptpubkey,
|
||||||
const struct secret *revocation_preimage,
|
const struct secret *revocation_preimage,
|
||||||
const struct bitcoin_txid *commitment_txid,
|
const struct bitcoin_txid *commitment_txid,
|
||||||
s16 to_them_outnum, struct amount_sat to_them_sats)
|
s16 to_them_outnum, struct amount_sat to_them_sats,
|
||||||
|
int hsm_fd)
|
||||||
{
|
{
|
||||||
u8 *wscript;
|
u8 *wscript;
|
||||||
struct bitcoin_tx *tx;
|
struct bitcoin_tx *tx;
|
||||||
|
@ -105,11 +105,11 @@ penalty_tx_create(const tal_t *ctx,
|
||||||
towire_hsm_sign_penalty_to_us(ctx, &remote_per_commitment_secret, tx,
|
towire_hsm_sign_penalty_to_us(ctx, &remote_per_commitment_secret, tx,
|
||||||
wscript, *tx->input_amounts[0]);
|
wscript, *tx->input_amounts[0]);
|
||||||
|
|
||||||
if (!wire_sync_write(HSM_FD, take(hsm_sign_msg)))
|
if (!wire_sync_write(hsm_fd, take(hsm_sign_msg)))
|
||||||
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
||||||
"Writing sign request to hsm");
|
"Writing sign request to hsm");
|
||||||
|
|
||||||
msg = wire_sync_read(tmpctx, HSM_FD);
|
msg = wire_sync_read(tmpctx, hsm_fd);
|
||||||
if (!msg || !fromwire_hsm_sign_tx_reply(msg, &sig))
|
if (!msg || !fromwire_hsm_sign_tx_reply(msg, &sig))
|
||||||
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
||||||
"Reading sign_tx_reply: %s", tal_hex(tmpctx, msg));
|
"Reading sign_tx_reply: %s", tal_hex(tmpctx, msg));
|
||||||
|
|
|
@ -13,6 +13,7 @@ penalty_tx_create(const tal_t *ctx,
|
||||||
u8 *final_scriptpubkey,
|
u8 *final_scriptpubkey,
|
||||||
const struct secret *revocation_preimage,
|
const struct secret *revocation_preimage,
|
||||||
const struct bitcoin_txid *commitment_txid,
|
const struct bitcoin_txid *commitment_txid,
|
||||||
s16 to_them_outnum, struct amount_sat to_them_sats);
|
s16 to_them_outnum, struct amount_sat to_them_sats,
|
||||||
|
int hsm_fd);
|
||||||
|
|
||||||
#endif /* LIGHTNING_CHANNELD_WATCHTOWER_H */
|
#endif /* LIGHTNING_CHANNELD_WATCHTOWER_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue