MCPcopy Create free account
hub / github.com/ElementsProject/lightning / is_mutual_close

Function is_mutual_close

onchaind/onchaind.c:1368–1394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1366}
1367
1368static bool is_mutual_close(const struct tx_parts *tx,
1369 const u8 *local_scriptpubkey,
1370 const u8 *remote_scriptpubkey)
1371{
1372 size_t i;
1373 bool local_matched = false, remote_matched = false;
1374
1375 for (i = 0; i < tal_count(tx->outputs); i++) {
1376 /* To be paranoid, we only let each one match once. */
1377 if (chainparams->is_elements &&
1378 tx->outputs[i]->script_len == 0) {
1379 /* This is a fee output, ignore please */
1380 continue;
1381 } else if (wally_tx_output_scripteq(tx->outputs[i],
1382 local_scriptpubkey)
1383 && !local_matched) {
1384 local_matched = true;
1385 } else if (wally_tx_output_scripteq(tx->outputs[i],
1386 remote_scriptpubkey)
1387 && !remote_matched)
1388 remote_matched = true;
1389 else
1390 return false;
1391 }
1392
1393 return true;
1394}
1395
1396/* We only ever send out one, so matching it is easy. */
1397static bool is_local_commitment(const struct bitcoin_txid *txid,

Callers 1

mainFunction · 0.85

Calls 1

wally_tx_output_scripteqFunction · 0.85

Tested by

no test coverage detected