| 810 | } |
| 811 | |
| 812 | static u64 unmask_commit_number(const struct tx_parts *tx, |
| 813 | uint32_t locktime, |
| 814 | enum side opener, |
| 815 | const struct pubkey *local_payment_basepoint, |
| 816 | const struct pubkey *remote_payment_basepoint) |
| 817 | { |
| 818 | u64 obscurer; |
| 819 | const struct pubkey *keys[NUM_SIDES]; |
| 820 | keys[LOCAL] = local_payment_basepoint; |
| 821 | keys[REMOTE] = remote_payment_basepoint; |
| 822 | |
| 823 | /* BOLT #3: |
| 824 | * |
| 825 | * The 48-bit commitment number is obscured by `XOR` with the lower 48 bits of... |
| 826 | */ |
| 827 | obscurer = commit_number_obscurer(keys[opener], keys[!opener]); |
| 828 | |
| 829 | /* BOLT #3: |
| 830 | * |
| 831 | * * locktime: upper 8 bits are 0x20, lower 24 bits are the lower 24 bits of the obscured commitment number |
| 832 | *... |
| 833 | * * `txin[0]` sequence: upper 8 bits are 0x80, lower 24 bits are upper 24 bits of the obscured commitment number |
| 834 | */ |
| 835 | return ((locktime & 0x00FFFFFF) |
| 836 | | (tx->inputs[0]->sequence & (u64)0x00FFFFFF) << 24) |
| 837 | ^ obscurer; |
| 838 | } |
| 839 | |
| 840 | static bool is_mutual_close(const struct tx_parts *tx, |
| 841 | const u8 *local_scriptpubkey, |
no test coverage detected