Skip to content

Two post-#230 fixups #255

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

Merged
merged 2 commits into from
Nov 21, 2018
Merged

Conversation

TheBlueMatt
Copy link
Collaborator

The first simplifies the API in a way that @ariard seemed to indicate was incorrect but the tests appear to still pass and I'm not sure why, so I'll let him tell me why I'm wrong here. The second fixes an I-believe-bug and also makes things a bit more performant.

@TheBlueMatt TheBlueMatt added this to the 0.0.7 milestone Nov 20, 2018
This extends 1b33064 by
re-simplifying the ChannelMonitor <-> Channel interface a bit as we
never have any use for the latest remote commitment point until we
have knowledge of a remote transaction generated using it.
This fixes a bug in 3518f1f where
we may generate an output event for a P2WPKH output which is not
ours if the transaction has a sequence/lock_time combination which
false-positives our remote tx detection.

Also note that the TODO is removed as this should already be
covered without issue if the client properly replays the chain on
restart.
@@ -929,23 +938,12 @@ impl ChannelMonitor {
htlc_idxs.push(None);
values.push(outp.value);
total_value += outp.value;
} else if outp.script_pubkey.is_v0_p2wpkh() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure for the bug fixes, the only P2WPKH from a remote revoked tx is ours following bolt 3, how the sequence/lock-time mess can false-positives the tx detection ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically at this point in check_spend_remote_transaction we aren't even sure if the transaction spends our funding transaction or if its just some random transaction that had the right bits set in its input-0-nSequence and lock time to make it match our commitment number xor check. I guess in the non-watchtower case it should be the case that self.funding_txo.is_some() which would mean we do know for sure, but to keep things consistent its easier to just not assume that here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes you're right, in non-watchtower were we don't have funding_txo set (and can't assume we face commitment tx) this could generate falses-positives

@ariard
Copy link

ariard commented Nov 21, 2018

I think that 90b0ed9 is good, I read again the conversation in #230 on this point, and I think we misunderstood each other, what I would like to say is that in case of sizeable push_msat, we don't need remote_tx info only per_commitment_point and you said that we use per_commitment_point only in conjunction with remote_tx info. So yes finally it's indifferent that we provide per_commitment_point at same time with provide_latest_remote_commitment_tx_info, in some cases we will use both infos to generate tx, sometimes not. Thanks to prune superflous provisions (but on this point maybe that 394b11c solved it without me notifying)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants