| 1338 | } |
| 1339 | |
| 1340 | static u64 unmask_commit_number(const struct tx_parts *tx, |
| 1341 | uint32_t locktime, |
| 1342 | enum side opener, |
| 1343 | const struct pubkey *local_payment_basepoint, |
| 1344 | const struct pubkey *remote_payment_basepoint) |
| 1345 | { |
| 1346 | u64 obscurer; |
| 1347 | const struct pubkey *keys[NUM_SIDES]; |
| 1348 | keys[LOCAL] = local_payment_basepoint; |
| 1349 | keys[REMOTE] = remote_payment_basepoint; |
| 1350 | |
| 1351 | /* BOLT #3: |
| 1352 | * |
| 1353 | * The 48-bit commitment number is obscured by `XOR` with the lower 48 bits of... |
| 1354 | */ |
| 1355 | obscurer = commit_number_obscurer(keys[opener], keys[!opener]); |
| 1356 | |
| 1357 | /* BOLT #3: |
| 1358 | * |
| 1359 | * * locktime: upper 8 bits are 0x20, lower 24 bits are the lower 24 bits of the obscured commitment number |
| 1360 | *... |
| 1361 | * * `txin[0]` sequence: upper 8 bits are 0x80, lower 24 bits are upper 24 bits of the obscured commitment number |
| 1362 | */ |
| 1363 | return ((locktime & 0x00FFFFFF) |
| 1364 | | (tx->inputs[0]->sequence & (u64)0x00FFFFFF) << 24) |
| 1365 | ^ obscurer; |
| 1366 | } |
| 1367 | |
| 1368 | static bool is_mutual_close(const struct tx_parts *tx, |
| 1369 | const u8 *local_scriptpubkey, |
no test coverage detected