Remove general shadowed variables.

We shadow local variables in several places: generally, these changes
make the code clearer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-07-25 16:30:09 +09:30
committed by neil saitug
parent 6a7d40f51a
commit 6fe570820e
25 changed files with 92 additions and 99 deletions

View File

@@ -120,7 +120,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
struct amount_sat base_fee;
struct amount_msat total_pay;
struct bitcoin_tx *tx;
size_t i, n, untrimmed;
size_t n, untrimmed;
/* Is this the lessor ? */
enum side lessor = !opener;
u32 *cltvs;
@@ -181,7 +181,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
{
struct amount_sat out = AMOUNT_SAT(0);
bool ok = true;
for (i = 0; i < tal_count(htlcs); i++) {
for (size_t i = 0; i < tal_count(htlcs); i++) {
if (!trim(htlcs[i], feerate_per_kw, dust_limit,
option_anchor_outputs, side))
ok &= amount_sat_add(&out, out, amount_msat_to_sat_round_down(htlcs[i]->amount));
@@ -215,7 +215,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
* 4. For every offered HTLC, if it is not trimmed, add an
* [offered HTLC output](#offered-htlc-outputs).
*/
for (i = 0; i < tal_count(htlcs); i++) {
for (size_t i = 0; i < tal_count(htlcs); i++) {
if (htlc_owner(htlcs[i]) != side)
continue;
if (trim(htlcs[i], feerate_per_kw, dust_limit,
@@ -233,7 +233,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
* 5. For every received HTLC, if it is not trimmed, add an
* [received HTLC output](#received-htlc-outputs).
*/
for (i = 0; i < tal_count(htlcs); i++) {
for (size_t i = 0; i < tal_count(htlcs); i++) {
if (htlc_owner(htlcs[i]) == side)
continue;
if (trim(htlcs[i], feerate_per_kw, dust_limit,