/// to drop us, but we store this anyway.
ShutdownComplete = 4096,
}
-const BOTH_SIDES_SHUTDOWN_MASK: u32 = (ChannelState::LocalShutdownSent as u32 | ChannelState::RemoteShutdownSent as u32);
-const MULTI_STATE_FLAGS: u32 = (BOTH_SIDES_SHUTDOWN_MASK | ChannelState::PeerDisconnected as u32 | ChannelState::MonitorUpdateFailed as u32);
+const BOTH_SIDES_SHUTDOWN_MASK: u32 = ChannelState::LocalShutdownSent as u32 | ChannelState::RemoteShutdownSent as u32;
+const MULTI_STATE_FLAGS: u32 = BOTH_SIDES_SHUTDOWN_MASK | ChannelState::PeerDisconnected as u32 | ChannelState::MonitorUpdateFailed as u32;
const INITIAL_COMMITMENT_NUMBER: u64 = (1 << 48) - 1;
/// Maximmum `funding_satoshis` value, according to the BOLT #2 specification
/// it's 2^24.
-pub const MAX_FUNDING_SATOSHIS: u64 = (1 << 24);
+pub const MAX_FUNDING_SATOSHIS: u64 = 1 << 24;
/// Used to return a simple Error back to ChannelManager. Will get converted to a
/// msgs::ErrorAction::SendErrorMessage or msgs::ErrorAction::IgnoreError as appropriate with our
return Err(ChannelError::Close("Remote provided CLTV expiry in seconds instead of block height"));
}
- //TODO: Check msg.cltv_expiry further? Do this in channel manager?
-
if self.channel_state & ChannelState::LocalShutdownSent as u32 != 0 {
if let PendingHTLCStatus::Forward(_) = pending_forward_state {
panic!("ChannelManager shouldn't be trying to add a forwardable HTLC after we've started closing");
return Err(ChannelError::Ignore("Cannot send value that would put us over their reserve value"));
}
- //TODO: Check cltv_expiry? Do this in channel manager?
-
// Now update local state:
if (self.channel_state & (ChannelState::AwaitingRemoteRevoke as u32)) == (ChannelState::AwaitingRemoteRevoke as u32) {
self.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::AddHTLC {
assert_eq!(unsigned_tx.1.len(), per_htlc.len());
localtx = LocalCommitmentTransaction::new_missing_local_sig(unsigned_tx.0.clone(), &their_signature, &PublicKey::from_secret_key(&secp_ctx, chan.local_keys.funding_key()), chan.their_funding_pubkey(), keys.clone(), chan.feerate_per_kw, per_htlc);
- chan_keys.sign_local_commitment(&mut localtx, &chan.secp_ctx);
+ let local_sig = chan_keys.sign_local_commitment(&localtx, &chan.secp_ctx).unwrap();
+ localtx.add_local_sig(&redeemscript, local_sig);
assert_eq!(serialize(localtx.with_valid_witness())[..],
hex::decode($tx_hex).unwrap()[..]);