Skip to content

Commit af4738b

Browse files
authored
Merge pull request #460 from lightning-signer/channel-value
Channel value to ChannelKeys constructor
2 parents 30a1275 + db39843 commit af4738b

File tree

6 files changed

+42
-27
lines changed

6 files changed

+42
-27
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl KeysInterface for KeyProvider {
150150
PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, self.node_id]).unwrap())
151151
}
152152

153-
fn get_channel_keys(&self, _inbound: bool) -> EnforcingChannelKeys {
153+
fn get_channel_keys(&self, _inbound: bool, channel_value_satoshis: u64) -> EnforcingChannelKeys {
154154
EnforcingChannelKeys::new(InMemoryChannelKeys {
155155
funding_key: SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, self.node_id]).unwrap(),
156156
revocation_base_key: SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, self.node_id]).unwrap(),
@@ -159,6 +159,7 @@ impl KeysInterface for KeyProvider {
159159
htlc_base_key: SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, self.node_id]).unwrap(),
160160
commitment_seed: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, self.node_id],
161161
remote_channel_pubkeys: None,
162+
channel_value_satoshis,
162163
})
163164
}
164165

fuzz/src/full_stack.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl KeysInterface for KeyProvider {
247247
PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap())
248248
}
249249

250-
fn get_channel_keys(&self, inbound: bool) -> EnforcingChannelKeys {
250+
fn get_channel_keys(&self, inbound: bool, channel_value_satoshis: u64) -> EnforcingChannelKeys {
251251
let ctr = self.counter.fetch_add(1, Ordering::Relaxed) as u8;
252252
EnforcingChannelKeys::new(if inbound {
253253
InMemoryChannelKeys {
@@ -258,6 +258,7 @@ impl KeysInterface for KeyProvider {
258258
htlc_base_key: SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, ctr]).unwrap(),
259259
commitment_seed: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, ctr],
260260
remote_channel_pubkeys: None,
261+
channel_value_satoshis: channel_value_satoshis,
261262
}
262263
} else {
263264
InMemoryChannelKeys {
@@ -268,6 +269,7 @@ impl KeysInterface for KeyProvider {
268269
htlc_base_key: SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, ctr]).unwrap(),
269270
commitment_seed: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, ctr],
270271
remote_channel_pubkeys: None,
272+
channel_value_satoshis: channel_value_satoshis,
271273
}
272274
})
273275
}

lightning/src/chain/keysinterface.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub trait KeysInterface: Send + Sync {
9999
fn get_shutdown_pubkey(&self) -> PublicKey;
100100
/// Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
101101
/// restarted with some stale data!
102-
fn get_channel_keys(&self, inbound: bool) -> Self::ChanKeySigner;
102+
fn get_channel_keys(&self, inbound: bool, channel_value_satoshis: u64) -> Self::ChanKeySigner;
103103
/// Get a secret and PRNG seed for construting an onion packet
104104
fn get_onion_rand(&self) -> (SecretKey, [u8; 32]);
105105
/// Get a unique temporary channel id. Channels will be referred to by this until the funding
@@ -155,13 +155,13 @@ pub trait ChannelKeys : Send {
155155
/// TODO: Document the things someone using this interface should enforce before signing.
156156
/// TODO: Add more input vars to enable better checking (preferably removing commitment_tx and
157157
/// making the callee generate it via some util function we expose)!
158-
fn sign_remote_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, channel_value_satoshis: u64, feerate_per_kw: u64, commitment_tx: &Transaction, keys: &TxCreationKeys, htlcs: &[&HTLCOutputInCommitment], to_self_delay: u16, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()>;
158+
fn sign_remote_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, feerate_per_kw: u64, commitment_tx: &Transaction, keys: &TxCreationKeys, htlcs: &[&HTLCOutputInCommitment], to_self_delay: u16, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()>;
159159

160160
/// Create a signature for a (proposed) closing transaction.
161161
///
162162
/// Note that, due to rounding, there may be one "missing" satoshi, and either party may have
163163
/// chosen to forgo their output as dust.
164-
fn sign_closing_transaction<T: secp256k1::Signing>(&self, channel_value_satoshis: u64, channel_funding_redeemscript: &Script, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
164+
fn sign_closing_transaction<T: secp256k1::Signing>(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
165165

166166
/// Signs a channel announcement message with our funding key, proving it comes from one
167167
/// of the channel participants.
@@ -193,8 +193,10 @@ pub struct InMemoryChannelKeys {
193193
pub htlc_base_key: SecretKey,
194194
/// Commitment seed
195195
pub commitment_seed: [u8; 32],
196-
/// Remote funding pubkey
196+
/// Remote public keys and base points
197197
pub remote_channel_pubkeys: Option<ChannelPublicKeys>,
198+
/// The total value of this channel
199+
pub channel_value_satoshis: u64,
198200
}
199201

200202
impl ChannelKeys for InMemoryChannelKeys {
@@ -205,14 +207,14 @@ impl ChannelKeys for InMemoryChannelKeys {
205207
fn htlc_base_key(&self) -> &SecretKey { &self.htlc_base_key }
206208
fn commitment_seed(&self) -> &[u8; 32] { &self.commitment_seed }
207209

208-
fn sign_remote_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, channel_value_satoshis: u64, feerate_per_kw: u64, commitment_tx: &Transaction, keys: &TxCreationKeys, htlcs: &[&HTLCOutputInCommitment], to_self_delay: u16, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> {
210+
fn sign_remote_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, feerate_per_kw: u64, commitment_tx: &Transaction, keys: &TxCreationKeys, htlcs: &[&HTLCOutputInCommitment], to_self_delay: u16, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> {
209211
if commitment_tx.input.len() != 1 { return Err(()); }
210212

211213
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
212214
let remote_channel_pubkeys = self.remote_channel_pubkeys.as_ref().expect("must set remote channel pubkeys before signing");
213215
let channel_funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &remote_channel_pubkeys.funding_pubkey);
214216

215-
let commitment_sighash = hash_to_message!(&bip143::SighashComponents::new(&commitment_tx).sighash_all(&commitment_tx.input[0], &channel_funding_redeemscript, channel_value_satoshis)[..]);
217+
let commitment_sighash = hash_to_message!(&bip143::SighashComponents::new(&commitment_tx).sighash_all(&commitment_tx.input[0], &channel_funding_redeemscript, self.channel_value_satoshis)[..]);
216218
let commitment_sig = secp_ctx.sign(&commitment_sighash, &self.funding_key);
217219

218220
let commitment_txid = commitment_tx.txid();
@@ -234,13 +236,17 @@ impl ChannelKeys for InMemoryChannelKeys {
234236
Ok((commitment_sig, htlc_sigs))
235237
}
236238

237-
fn sign_closing_transaction<T: secp256k1::Signing>(&self, channel_value_satoshis: u64, channel_funding_redeemscript: &Script, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
239+
fn sign_closing_transaction<T: secp256k1::Signing>(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
238240
if closing_tx.input.len() != 1 { return Err(()); }
239241
if closing_tx.input[0].witness.len() != 0 { return Err(()); }
240242
if closing_tx.output.len() > 2 { return Err(()); }
241243

244+
let remote_channel_pubkeys = self.remote_channel_pubkeys.as_ref().expect("must set remote channel pubkeys before signing");
245+
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
246+
let channel_funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &remote_channel_pubkeys.funding_pubkey);
247+
242248
let sighash = hash_to_message!(&bip143::SighashComponents::new(closing_tx)
243-
.sighash_all(&closing_tx.input[0], &channel_funding_redeemscript, channel_value_satoshis)[..]);
249+
.sighash_all(&closing_tx.input[0], &channel_funding_redeemscript, self.channel_value_satoshis)[..]);
244250
Ok(secp_ctx.sign(&sighash, &self.funding_key))
245251
}
246252

@@ -262,7 +268,8 @@ impl_writeable!(InMemoryChannelKeys, 0, {
262268
delayed_payment_base_key,
263269
htlc_base_key,
264270
commitment_seed,
265-
remote_channel_pubkeys
271+
remote_channel_pubkeys,
272+
channel_value_satoshis
266273
});
267274

268275
/// Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
@@ -371,7 +378,7 @@ impl KeysInterface for KeysManager {
371378
self.shutdown_pubkey.clone()
372379
}
373380

374-
fn get_channel_keys(&self, _inbound: bool) -> InMemoryChannelKeys {
381+
fn get_channel_keys(&self, _inbound: bool, channel_value_satoshis: u64) -> InMemoryChannelKeys {
375382
// We only seriously intend to rely on the channel_master_key for true secure
376383
// entropy, everything else just ensures uniqueness. We rely on the unique_start (ie
377384
// starting_time provided in the constructor) to be unique.
@@ -412,6 +419,7 @@ impl KeysInterface for KeysManager {
412419
htlc_base_key,
413420
commitment_seed,
414421
remote_channel_pubkeys: None,
422+
channel_value_satoshis,
415423
}
416424
}
417425

lightning/src/ln/channel.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
420420

421421
// Constructors:
422422
pub fn new_outbound(fee_estimator: &FeeEstimator, keys_provider: &Arc<KeysInterface<ChanKeySigner = ChanSigner>>, their_node_id: PublicKey, channel_value_satoshis: u64, push_msat: u64, user_id: u64, logger: Arc<Logger>, config: &UserConfig) -> Result<Channel<ChanSigner>, APIError> {
423-
let chan_keys = keys_provider.get_channel_keys(false);
423+
let chan_keys = keys_provider.get_channel_keys(false, channel_value_satoshis);
424424

425425
if channel_value_satoshis >= MAX_FUNDING_SATOSHIS {
426426
return Err(APIError::APIMisuseError{err: "funding value > 2^24"});
@@ -532,7 +532,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
532532
/// Creates a new channel from a remote sides' request for one.
533533
/// Assumes chain_hash has already been checked and corresponds with what we expect!
534534
pub fn new_from_req(fee_estimator: &FeeEstimator, keys_provider: &Arc<KeysInterface<ChanKeySigner = ChanSigner>>, their_node_id: PublicKey, their_features: InitFeatures, msg: &msgs::OpenChannel, user_id: u64, logger: Arc<Logger>, config: &UserConfig) -> Result<Channel<ChanSigner>, ChannelError> {
535-
let mut chan_keys = keys_provider.get_channel_keys(true);
535+
let mut chan_keys = keys_provider.get_channel_keys(true, msg.funding_satoshis);
536536
let their_pubkeys = ChannelPublicKeys {
537537
funding_pubkey: msg.funding_pubkey,
538538
revocation_basepoint: msg.revocation_basepoint,
@@ -1418,7 +1418,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
14181418

14191419
let remote_keys = self.build_remote_transaction_keys()?;
14201420
let remote_initial_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number, &remote_keys, false, false, self.feerate_per_kw).0;
1421-
let remote_signature = self.local_keys.sign_remote_commitment(self.channel_value_satoshis, self.feerate_per_kw, &remote_initial_commitment_tx, &remote_keys, &Vec::new(), self.our_to_self_delay, &self.secp_ctx)
1421+
let remote_signature = self.local_keys.sign_remote_commitment(self.feerate_per_kw, &remote_initial_commitment_tx, &remote_keys, &Vec::new(), self.our_to_self_delay, &self.secp_ctx)
14221422
.map_err(|_| ChannelError::Close("Failed to get signatures for new commitment_signed"))?.0;
14231423

14241424
// We sign the "remote" commitment transaction, allowing them to broadcast the tx if they wish.
@@ -2563,7 +2563,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
25632563

25642564
let (closing_tx, total_fee_satoshis) = self.build_closing_transaction(proposed_total_fee_satoshis, false);
25652565
let our_sig = self.local_keys
2566-
.sign_closing_transaction(self.channel_value_satoshis, &self.get_funding_redeemscript(), &closing_tx, &self.secp_ctx)
2566+
.sign_closing_transaction(&closing_tx, &self.secp_ctx)
25672567
.ok();
25682568
if our_sig.is_none() { return None; }
25692569

@@ -2719,7 +2719,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
27192719
let closing_tx_max_weight = Self::get_closing_transaction_weight(&self.get_closing_scriptpubkey(), self.their_shutdown_scriptpubkey.as_ref().unwrap());
27202720
let (closing_tx, used_total_fee) = self.build_closing_transaction($new_feerate * closing_tx_max_weight / 1000, false);
27212721
let our_sig = self.local_keys
2722-
.sign_closing_transaction(self.channel_value_satoshis, &funding_redeemscript, &closing_tx, &self.secp_ctx)
2722+
.sign_closing_transaction(&closing_tx, &self.secp_ctx)
27232723
.map_err(|_| ChannelError::Close("External signer refused to sign closing transaction"))?;
27242724
self.last_sent_closing_fee = Some(($new_feerate, used_total_fee, our_sig.clone()));
27252725
return Ok((Some(msgs::ClosingSigned {
@@ -2754,7 +2754,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
27542754
}
27552755

27562756
let our_sig = self.local_keys
2757-
.sign_closing_transaction(self.channel_value_satoshis, &funding_redeemscript, &closing_tx, &self.secp_ctx)
2757+
.sign_closing_transaction(&closing_tx, &self.secp_ctx)
27582758
.map_err(|_| ChannelError::Close("External signer refused to sign closing transaction"))?;
27592759
self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &our_sig);
27602760

@@ -3154,7 +3154,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
31543154
fn get_outbound_funding_created_signature(&mut self) -> Result<(Signature, Transaction), ChannelError> {
31553155
let remote_keys = self.build_remote_transaction_keys()?;
31563156
let remote_initial_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number, &remote_keys, false, false, self.feerate_per_kw).0;
3157-
Ok((self.local_keys.sign_remote_commitment(self.channel_value_satoshis, self.feerate_per_kw, &remote_initial_commitment_tx, &remote_keys, &Vec::new(), self.our_to_self_delay, &self.secp_ctx)
3157+
Ok((self.local_keys.sign_remote_commitment(self.feerate_per_kw, &remote_initial_commitment_tx, &remote_keys, &Vec::new(), self.our_to_self_delay, &self.secp_ctx)
31583158
.map_err(|_| ChannelError::Close("Failed to get signatures for new commitment_signed"))?.0, remote_initial_commitment_tx))
31593159
}
31603160

@@ -3462,7 +3462,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
34623462
htlcs.push(htlc);
34633463
}
34643464

3465-
let res = self.local_keys.sign_remote_commitment(self.channel_value_satoshis, feerate_per_kw, &remote_commitment_tx.0, &remote_keys, &htlcs, self.our_to_self_delay, &self.secp_ctx)
3465+
let res = self.local_keys.sign_remote_commitment(feerate_per_kw, &remote_commitment_tx.0, &remote_keys, &htlcs, self.our_to_self_delay, &self.secp_ctx)
34663466
.map_err(|_| ChannelError::Close("Failed to get signatures for new commitment_signed"))?;
34673467
signature = res.0;
34683468
htlc_signatures = res.1;
@@ -4101,7 +4101,9 @@ mod tests {
41014101
PublicKey::from_secret_key(&secp_ctx, &channel_close_key)
41024102
}
41034103

4104-
fn get_channel_keys(&self, _inbound: bool) -> InMemoryChannelKeys { self.chan_keys.clone() }
4104+
fn get_channel_keys(&self, _inbound: bool, channel_value_satoshis: u64) -> InMemoryChannelKeys {
4105+
self.chan_keys.clone()
4106+
}
41054107
fn get_onion_rand(&self) -> (SecretKey, [u8; 32]) { panic!(); }
41064108
fn get_channel_id(&self) -> [u8; 32] { [0; 32] }
41074109
}
@@ -4127,6 +4129,7 @@ mod tests {
41274129
revocation_base_key: SecretKey::from_slice(&hex::decode("0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()[..]).unwrap(),
41284130
commitment_seed: [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff],
41294131
remote_channel_pubkeys: None,
4132+
channel_value_satoshis: 7000000000,
41304133
};
41314134
assert_eq!(PublicKey::from_secret_key(&secp_ctx, chan_keys.funding_key()).serialize()[..],
41324135
hex::decode("023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb").unwrap()[..]);

lightning/src/util/enforcing_trait_impls.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::cmp;
66
use std::sync::Mutex;
77

88
use bitcoin::blockdata::transaction::Transaction;
9-
use bitcoin::blockdata::script::Script;
109

1110
use secp256k1;
1211
use secp256k1::key::{SecretKey, PublicKey};
@@ -56,7 +55,7 @@ impl ChannelKeys for EnforcingChannelKeys {
5655
fn htlc_base_key(&self) -> &SecretKey { self.inner.htlc_base_key() }
5756
fn commitment_seed(&self) -> &[u8; 32] { self.inner.commitment_seed() }
5857

59-
fn sign_remote_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, channel_value_satoshis: u64, feerate_per_kw: u64, commitment_tx: &Transaction, keys: &TxCreationKeys, htlcs: &[&HTLCOutputInCommitment], to_self_delay: u16, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> {
58+
fn sign_remote_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, feerate_per_kw: u64, commitment_tx: &Transaction, keys: &TxCreationKeys, htlcs: &[&HTLCOutputInCommitment], to_self_delay: u16, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> {
6059
if commitment_tx.input.len() != 1 { panic!("lightning commitment transactions have a single input"); }
6160
self.check_keys(secp_ctx, keys);
6261
let obscured_commitment_transaction_number = (commitment_tx.lock_time & 0xffffff) as u64 | ((commitment_tx.input[0].sequence as u64 & 0xffffff) << 3*8);
@@ -71,11 +70,11 @@ impl ChannelKeys for EnforcingChannelKeys {
7170
commitment_data.1 = cmp::max(commitment_number, commitment_data.1)
7271
}
7372

74-
Ok(self.inner.sign_remote_commitment(channel_value_satoshis, feerate_per_kw, commitment_tx, keys, htlcs, to_self_delay, secp_ctx).unwrap())
73+
Ok(self.inner.sign_remote_commitment(feerate_per_kw, commitment_tx, keys, htlcs, to_self_delay, secp_ctx).unwrap())
7574
}
7675

77-
fn sign_closing_transaction<T: secp256k1::Signing>(&self, channel_value_satoshis: u64, channel_funding_redeemscript: &Script, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
78-
Ok(self.inner.sign_closing_transaction(channel_value_satoshis, channel_funding_redeemscript, closing_tx, secp_ctx).unwrap())
76+
fn sign_closing_transaction<T: secp256k1::Signing>(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
77+
Ok(self.inner.sign_closing_transaction(closing_tx, secp_ctx).unwrap())
7978
}
8079

8180
fn sign_channel_announcement<T: secp256k1::Signing>(&self, msg: &msgs::UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {

lightning/src/util/test_utils.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ impl keysinterface::KeysInterface for TestKeysInterface {
203203
fn get_node_secret(&self) -> SecretKey { self.backing.get_node_secret() }
204204
fn get_destination_script(&self) -> Script { self.backing.get_destination_script() }
205205
fn get_shutdown_pubkey(&self) -> PublicKey { self.backing.get_shutdown_pubkey() }
206-
fn get_channel_keys(&self, inbound: bool) -> EnforcingChannelKeys { EnforcingChannelKeys::new(self.backing.get_channel_keys(inbound)) }
206+
fn get_channel_keys(&self, inbound: bool, channel_value_satoshis: u64) -> EnforcingChannelKeys {
207+
EnforcingChannelKeys::new(self.backing.get_channel_keys(inbound, channel_value_satoshis))
208+
}
207209

208210
fn get_onion_rand(&self) -> (SecretKey, [u8; 32]) {
209211
match *self.override_session_priv.lock().unwrap() {

0 commit comments

Comments
 (0)