-
Notifications
You must be signed in to change notification settings - Fork 407
Delay DelayedPaymentOutput spendable events until the CSV delay #936
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
Delay DelayedPaymentOutput spendable events until the CSV delay #936
Conversation
Codecov Report
@@ Coverage Diff @@
## main #936 +/- ##
==========================================
+ Coverage 90.53% 90.88% +0.34%
==========================================
Files 60 60
Lines 30697 31957 +1260
==========================================
+ Hits 27792 29044 +1252
- Misses 2905 2913 +8
Continue to review full report at Codecov.
|
fn connect_blocks(node: &mut Node, block_count: u32) { | ||
for i in 1..=block_count { | ||
let prev_blockhash = node.best_block.block_hash(); | ||
let height = node.best_block.height() + 1; | ||
let header = BlockHeader { version: 0x20000000, prev_blockhash, merkle_root: Default::default(), time: height, bits: 42, nonce: 42 }; | ||
node.best_block = BestBlock::new(header.block_hash(), height); | ||
if i == block_count { | ||
node.node.best_block_updated(&header, height); | ||
node.chain_monitor.best_block_updated(&header, height); | ||
} | ||
} | ||
} |
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.
Would it be worth de-duplicating confirm_transaction
and connect_blocks
?
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.
Right, I stared at it a bit but it looked like de-duplicating would have as much boilerplate as code it would avoid. Not sure if you had something specific in mind.
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.
I suppose you can instead just use confirm_transaction
but replace ANTI_REORG_DELAY
with BREAKDOWN_TIMEOUT as u32 - 1
.
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.
Ah! Duh, yes, that would work.
@@ -5507,12 +5509,14 @@ fn test_dynamic_spendable_outputs_local_htlc_success_tx() { | |||
}; | |||
|
|||
mine_transaction(&nodes[1], &node_tx); | |||
connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1); | |||
connect_blocks(&nodes[1], BREAKDOWN_TIMEOUT as u32 - 1); |
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.
Probably outside the scope of the PR, but I feel like BREAKDOWN_TIMEOUT
could use a better name.
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.
Probably, the fact that its public with such an awkward name kinda sucks.
4164176
to
2d0756d
Compare
f4e4603
to
e60ccbb
Compare
Squashed without diff:
|
No description provided.