You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace config max counterpary dust_limit_satoshis by a constant.
Current Bitcoin Core's policy will reject a p2wsh as a dust if it's
under 330 satoshis. A typical p2wsh output is 43 bytes big to which
Core's `GetDustThreshold()` sums up a minimal spend of 67 bytes (even
if a p2wsh witnessScript might be smaller). `dustRelayFee` is set
to 3000 sat/kb, thus 110 * 3000 / 1000 = 330. As all time-sensitive
outputs are p2wsh, a value of 330 sat is the lower bound desired
to ensure good propagation of transactions. We give a bit margin to
our counterparty and pick up 660 satoshis as an accepted
`dust_limit_satoshis` upper bound.
As this reasoning is tricky and error-prone we hardcode it instead of
letting the user picking up a non-sense value.
if msg.dust_limit_satoshis < config.peer_channel_config_limits.min_dust_limit_satoshis{
691
694
returnErr(ChannelError::Close(format!("dust_limit_satoshis ({}) is less than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.min_dust_limit_satoshis)));
692
695
}
693
-
if msg.dust_limit_satoshis > config.peer_channel_config_limits.max_dust_limit_satoshis{
694
-
returnErr(ChannelError::Close(format!("dust_limit_satoshis ({}) is greater than the user specified limit ({})", msg.dust_limit_satoshis,config.peer_channel_config_limits.max_dust_limit_satoshis)));
696
+
if msg.dust_limit_satoshis > MAX_DUST_LIMIT_SATOSHIS{
697
+
returnErr(ChannelError::Close(format!("dust_limit_satoshis ({}) is greater than the implementation limit ({})", msg.dust_limit_satoshis,MAX_DUST_LIMIT_SATOSHIS)));
695
698
}
696
699
697
700
// Convert things into internal flags and prep our state:
if msg.dust_limit_satoshis < config.peer_channel_config_limits.min_dust_limit_satoshis{
1430
1433
returnErr(ChannelError::Close(format!("dust_limit_satoshis ({}) is less than the user specified limit ({})", msg.dust_limit_satoshis, config.peer_channel_config_limits.min_dust_limit_satoshis)));
1431
1434
}
1432
-
if msg.dust_limit_satoshis > config.peer_channel_config_limits.max_dust_limit_satoshis{
1433
-
returnErr(ChannelError::Close(format!("dust_limit_satoshis ({}) is greater than the user specified limit ({})", msg.dust_limit_satoshis,config.peer_channel_config_limits.max_dust_limit_satoshis)));
1435
+
if msg.dust_limit_satoshis > MAX_DUST_LIMIT_SATOSHIS{
1436
+
returnErr(ChannelError::Close(format!("dust_limit_satoshis ({}) is greater than the implementation limit ({})", msg.dust_limit_satoshis,MAX_DUST_LIMIT_SATOSHIS)));
1434
1437
}
1435
1438
if msg.minimum_depth > config.peer_channel_config_limits.max_minimum_depth{
1436
1439
returnErr(ChannelError::Close(format!("We consider the minimum depth to be unreasonably large. Expected minimum: ({}). Actual: ({})", config.peer_channel_config_limits.max_minimum_depth, msg.minimum_depth)));
0 commit comments