Skip to content

Commit cc0b4be

Browse files
committed
Implement anti-fee sniping on funding tx
I.e., set `nLockTime` to current block height
1 parent 6ba6386 commit cc0b4be

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/event.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ where
270270
// channel.
271271
let confirmation_target = ConfirmationTarget::Normal;
272272

273+
// We set nLockTime to the current height to discourage fee sniping.
273274
let cur_height = self.channel_manager.current_best_block().height();
274275
let locktime = LockTime::from_height(cur_height).unwrap_or(LockTime::ZERO);
275276

@@ -574,6 +575,7 @@ where
574575
Some(locktime),
575576
&Secp256k1::new(),
576577
);
578+
577579
match res {
578580
Ok(Some(spending_tx)) => self.wallet.broadcast_transactions(&[&spending_tx]),
579581
Ok(None) => {

0 commit comments

Comments
 (0)