-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit test to check the validitiy of commitment transaction #39
Conversation
4336f08
to
9037cc4
Compare
734e170
to
5d1bb6e
Compare
return Ok(()); | ||
} | ||
let current_capacity: u64 = output.capacity().unpack(); | ||
let capacity = request.local_amount + current_capacity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emm, we need to care about UDT on this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. We should also take care of UDT here, which would depend on your work. So, for now, we'd better leave this as a known issue.
This PR partly resolves #26. It tests that we can broadcast the commitment transaction to the network (i.e. commitment transaction is valid). We need also to create a test which consumes the comitment tx output (e.g.with revocation key).
The notable changes to this PR are:
SendTx
will be verified. If this transaction is invalid then the response toTraceTx
request will returnStatus::Rejected
. This is very useful to quickly check the validity of any transactions. In this PR, I used this infrastructure to test the commitment transaction can indeed consume the funding cell.CommitmentSignaturePending
which tells the owner it is his turn to sign a commitment transaction (this makes it quite easy to solve Automatically generate CommitmentSigned responses in channel establishment #27,.RemoteCommitmentSigned
to signify a new commitment is signed by the remote.