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

Function input_similar

onchaind/onchaind.c:1236–1273  ·  view source on GitHub ↗

We ignore things which look like signatures. */

Source from the content-addressed store, hash-verified

1234
1235/* We ignore things which look like signatures. */
1236static bool input_similar(const struct wally_tx_input *i1,
1237 const struct wally_tx_input *i2)
1238{
1239 u8 *s1, *s2;
1240
1241 if (!memeq(i1->txhash, WALLY_TXHASH_LEN, i2->txhash, WALLY_TXHASH_LEN))
1242 return false;
1243
1244 if (i1->index != i2->index)
1245 return false;
1246
1247 if (!scripteq(i1->script, i2->script))
1248 return false;
1249
1250 if (i1->sequence != i2->sequence)
1251 return false;
1252
1253 if (i1->witness->num_items != i2->witness->num_items)
1254 return false;
1255
1256 for (size_t i = 0; i < i1->witness->num_items; i++) {
1257 /* Need to wrap these in `tal_arr`s since the primitives
1258 * except to be able to call tal_bytelen on them */
1259 s1 = tal_dup_arr(tmpctx, u8, i1->witness->items[i].witness,
1260 i1->witness->items[i].witness_len, 0);
1261 s2 = tal_dup_arr(tmpctx, u8, i2->witness->items[i].witness,
1262 i2->witness->items[i].witness_len, 0);
1263
1264 if (scripteq(s1, s2))
1265 continue;
1266
1267 if (is_valid_sig(s1) && is_valid_sig(s2))
1268 continue;
1269 return false;
1270 }
1271
1272 return true;
1273}
1274
1275/* This simple case: true if this was resolved by our proposal. */
1276static bool resolved_by_proposal(struct tracked_output *out,

Callers 1

resolved_by_proposalFunction · 0.85

Calls 3

memeqFunction · 0.85
scripteqFunction · 0.85
is_valid_sigFunction · 0.85

Tested by

no test coverage detected