bitcoin: rename confusing functions.

1. anchor_to_remote_redeem => bitcoin_wscript_to_remote_anchored,
   which matches other witness script producing functions and makes
   it clear that it's a to_remote variant.
2. is_anchor_witness_script => is_to_remote_anchored_witness_script
   makes it clear that it's about a to_remote output (as altered
   when anchors are enabled) not an anchor output!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-04-10 09:45:56 +09:30
parent 57b2cbcb32
commit 2fb942d21c
10 changed files with 27 additions and 27 deletions

View File

@@ -329,9 +329,9 @@ u8 *scriptpubkey_witness_raw(const tal_t *ctx, u8 version,
* <remote_pubkey> OP_CHECKSIGVERIFY MAX(1, lease_end - blockheight) OP_CHECKSEQUENCEVERIFY
*/
u8 *anchor_to_remote_redeem(const tal_t *ctx,
const struct pubkey *remote_key,
u32 csv_lock)
u8 *bitcoin_wscript_to_remote_anchored(const tal_t *ctx,
const struct pubkey *remote_key,
u32 csv_lock)
{
u8 *script = tal_arr(ctx, u8, 0);
add_push_key(&script, remote_key);
@@ -339,11 +339,11 @@ u8 *anchor_to_remote_redeem(const tal_t *ctx,
add_number(&script, csv_lock);
add_op(&script, OP_CHECKSEQUENCEVERIFY);
assert(is_anchor_witness_script(script, tal_bytelen(script)));
assert(is_to_remote_anchored_witness_script(script, tal_bytelen(script)));
return script;
}
bool is_anchor_witness_script(const u8 *script, size_t script_len)
bool is_to_remote_anchored_witness_script(const u8 *script, size_t script_len)
{
size_t len = 34 + 1 + 1 + 1;
/* With option_will_fund, the pushbytes can be up to 2 bytes more