- let mut payment_preimage = [0; 32];
- if input.witness.len() == 5 && input.witness[4].len() == 138 {
- payment_preimage.copy_from_slice(&tx.input[0].witness[3]);
+ let mut payment_preimage = PaymentPreimage([0; 32]);
+ if (input.witness.len() == 3 && input.witness[2].len() == OFFERED_HTLC_SCRIPT_WEIGHT && input.witness[1].len() == 33)
+ || (input.witness.len() == 3 && input.witness[2].len() == ACCEPTED_HTLC_SCRIPT_WEIGHT && input.witness[1].len() == 33) {
+ log_error!(self, "Remote used revocation sig to take a {} HTLC output at index {} from commitment_tx {}", if input.witness[2].len() == OFFERED_HTLC_SCRIPT_WEIGHT { "offered" } else { "accepted" }, input.previous_output.vout, input.previous_output.txid);
+ } else if input.witness.len() == 5 && input.witness[4].len() == ACCEPTED_HTLC_SCRIPT_WEIGHT {
+ payment_preimage.0.copy_from_slice(&tx.input[0].witness[3]);