Check local signtures explicitly in channel tx-generation tests
authorMatt Corallo <git@bluematt.me>
Mon, 9 Mar 2020 17:45:15 +0000 (13:45 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 29 Apr 2020 18:50:09 +0000 (14:50 -0400)
It appears the local signatures which are specified in the channel
transaction-generation tests were never checked directly (though
they were checked as a part of the overall fully-signed-transaction
tests).

Check them explicitly so that they can be updated for static remote
key.

lightning/src/ln/channel.rs

index 2d94a00f59c2d35c6819974319ed0990d938898a..da3f038ec965924fe70c6ca7d2d9729fa7c1a765 100644 (file)
@@ -4517,6 +4517,7 @@ mod tests {
 
                                localtx = LocalCommitmentTransaction::new_missing_local_sig(unsigned_tx.0.clone(), their_signature.clone(), &PublicKey::from_secret_key(&secp_ctx, chan.local_keys.funding_key()), chan.their_funding_pubkey(), keys.clone(), chan.feerate_per_kw, per_htlc);
                                let local_sig = chan_keys.sign_local_commitment(&localtx, &chan.secp_ctx).unwrap();
+                               assert_eq!(Signature::from_der(&hex::decode($our_sig_hex).unwrap()[..]).unwrap(), local_sig);
 
                                assert_eq!(serialize(&localtx.add_local_sig(&redeemscript, local_sig))[..],
                                                hex::decode($tx_hex).unwrap()[..]);
@@ -4549,6 +4550,8 @@ mod tests {
                                        while (htlc_sig.1).1.is_none() { htlc_sig = htlc_sig_iter.next().unwrap(); }
                                        assert_eq!((htlc_sig.0).0.transaction_output_index, Some($htlc_idx));
 
+                                       let our_signature = Signature::from_der(&hex::decode($our_htlc_sig_hex).unwrap()[..]).unwrap();
+                                       assert_eq!(Some(our_signature), *(htlc_sig.1).1);
                                        assert_eq!(serialize(&localtx.get_signed_htlc_tx((htlc_sig.1).0, &(htlc_sig.1).1.unwrap(), &preimage, chan.their_to_self_delay))[..],
                                                        hex::decode($htlc_tx_hex).unwrap()[..]);
                                })*