mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
daemon/output_to_htlc: routines to map outputs for HTLCs for a given commit_num.
And use this to resolve old transactions by comparing outputs with HTLCs. Rather than remembering the output ordering for every one of their previous commitment transactions, we just remember the commitment number for each commitment txid, and when we see it, derive all the HTLC scriptpubkeys and the to-us and to-them scriptpubkeys, and figure out which is which. This avoids us having to save information on disk, except for the txid->commitment-number mapping (and the shachain). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -467,6 +467,17 @@ bool is_p2sh(const u8 *script, size_t script_len)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_p2wsh(const u8 *script, size_t script_len)
|
||||
{
|
||||
if (script_len != 1 + 1 + sizeof(struct sha256))
|
||||
return false;
|
||||
if (script[0] != OP_0)
|
||||
return false;
|
||||
if (script[1] != OP_PUSHBYTES(sizeof(struct sha256)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* A common script pattern: A can have it with secret, or B can have
|
||||
* it after delay. */
|
||||
u8 *bitcoin_redeem_secret_or_delay(const tal_t *ctx,
|
||||
|
||||
Reference in New Issue
Block a user