nervosnetwork / fiber

16 stars 8 forks source link

Fix two bugs #62

Closed contrun closed 3 months ago

contrun commented 3 months ago

This PR fixes two important bugs.

The first bug is that we saved the commitment points for acceptor in the wrong order! This is discovered by https://github.com/contrun/ckb-pcn-node/pull/59/commits/9218b25b11fad60a873736e52eb150aec647b2d2, which tries to send CommitmentSigned messages from both sides, thus discovered a mismatch between per commitment point and per commitment secret.

The second bug is that we are using the wrong per commitment point to construct commitment transaction. We should use the current commitment number (and obtain the current commitment point) to construct commitment transaction. Previously, we used previous commitment number. This bug goes undiscovered because we didn't actually use commitment point to derive new public keys. We just copy the old keys. Thus commitment transaction are still the same for both parties.