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

Function resolved_by_proposal

onchaind/onchaind.c:1276–1306  ·  view source on GitHub ↗

This simple case: true if this was resolved by our proposal. */

Source from the content-addressed store, hash-verified

1274
1275/* This simple case: true if this was resolved by our proposal. */
1276static bool resolved_by_proposal(struct tracked_output *out,
1277 const struct tx_parts *tx_parts)
1278{
1279 /* If there's no TX associated, it's not us. */
1280 if (!out->proposal->tx)
1281 return false;
1282
1283 /* Our proposal can change as feerates change. Input
1284 * comparison (ignoring signatures) works pretty well. */
1285 if (tal_count(tx_parts->inputs) != out->proposal->tx->wtx->num_inputs)
1286 return false;
1287
1288 for (size_t i = 0; i < tal_count(tx_parts->inputs); i++) {
1289 if (!input_similar(tx_parts->inputs[i],
1290 &out->proposal->tx->wtx->inputs[i]))
1291 return false;
1292 }
1293
1294 out->resolved = tal(out, struct resolution);
1295 out->resolved->txid = tx_parts->txid;
1296 status_debug("Resolved %s/%s by our proposal %s (%s)",
1297 tx_type_name(out->tx_type),
1298 output_type_name(out->output_type),
1299 tx_type_name(out->proposal->tx_type),
1300 type_to_string(tmpctx, struct bitcoin_txid,
1301 &out->resolved->txid));
1302
1303 out->resolved->depth = 0;
1304 out->resolved->tx_type = out->proposal->tx_type;
1305 return true;
1306}
1307
1308/* Otherwise, we figure out what happened and then call this. */
1309static void resolved_by_other(struct tracked_output *out,

Callers 1

output_spentFunction · 0.85

Calls 4

input_similarFunction · 0.85
tx_type_nameFunction · 0.85
output_type_nameFunction · 0.85
type_to_stringClass · 0.50

Tested by

no test coverage detected