use crate::events;
use crate::events::bump_transaction::{WalletSource, Utxo};
use crate::ln::types::ChannelId;
-use crate::ln::channelmanager::{ChannelDetails, self};
+use crate::ln::channel_state::ChannelDetails;
+use crate::ln::channelmanager;
#[cfg(test)]
use crate::ln::chan_utils::CommitmentTransaction;
use crate::ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
use bitcoin::psbt::Psbt;
use bitcoin::Sequence;
+use super::test_channel_signer::SignerOp;
+
pub fn pubkey(byte: u8) -> PublicKey {
let secp_ctx = Secp256k1::new();
PublicKey::from_secret_key(&secp_ctx, &privkey(byte))
fn create_blinded_paths<
T: secp256k1::Signing + secp256k1::Verification
>(
- &self, recipient: PublicKey, peers: Vec<ForwardNode>, secp_ctx: &Secp256k1<T>,
+ &self, recipient: PublicKey, peers: Vec<PublicKey>, secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedPath>, ()> {
self.router.create_blinded_paths(recipient, peers, secp_ctx)
}
+
+ fn create_compact_blinded_paths<
+ T: secp256k1::Signing + secp256k1::Verification
+ >(
+ &self, recipient: PublicKey, peers: Vec<ForwardNode>, secp_ctx: &Secp256k1<T>,
+ ) -> Result<Vec<BlindedPath>, ()> {
+ self.router.create_compact_blinded_paths(recipient, peers, secp_ctx)
+ }
}
impl<'a> Drop for TestRouter<'a> {
}
fn create_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
- &self, recipient: PublicKey, peers: Vec<ForwardNode>, secp_ctx: &Secp256k1<T>,
+ &self, recipient: PublicKey, peers: Vec<PublicKey>, secp_ctx: &Secp256k1<T>,
) -> Result<Vec<BlindedPath>, ()> {
self.inner.create_blinded_paths(recipient, peers, secp_ctx)
}
+
+ fn create_compact_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
+ &self, recipient: PublicKey, peers: Vec<ForwardNode>, secp_ctx: &Secp256k1<T>,
+ ) -> Result<Vec<BlindedPath>, ()> {
+ self.inner.create_compact_blinded_paths(recipient, peers, secp_ctx)
+ }
}
pub struct OnlyReadsKeysInterface {}
enforcement_states: Mutex<HashMap<[u8;32], Arc<Mutex<EnforcementState>>>>,
expectations: Mutex<Option<VecDeque<OnGetShutdownScriptpubkey>>>,
pub unavailable_signers: Mutex<HashSet<[u8; 32]>>,
+ pub unavailable_signers_ops: Mutex<HashMap<[u8; 32], HashSet<SignerOp>>>,
}
impl EntropySource for TestKeysInterface {
fn derive_channel_signer(&self, channel_value_satoshis: u64, channel_keys_id: [u8; 32]) -> TestChannelSigner {
let keys = self.backing.derive_channel_signer(channel_value_satoshis, channel_keys_id);
let state = self.make_enforcement_state_cell(keys.commitment_seed);
- let signer = TestChannelSigner::new_with_revoked(keys, state, self.disable_revocation_policy_check);
- if self.unavailable_signers.lock().unwrap().contains(&channel_keys_id) {
- signer.set_available(false);
+ let mut signer = TestChannelSigner::new_with_revoked(keys, state, self.disable_revocation_policy_check);
+ if let Some(ops) = self.unavailable_signers_ops.lock().unwrap().get(&channel_keys_id) {
+ for &op in ops {
+ signer.disable_op(op);
+ }
}
signer
}
enforcement_states: Mutex::new(new_hash_map()),
expectations: Mutex::new(None),
unavailable_signers: Mutex::new(new_hash_set()),
+ unavailable_signers_ops: Mutex::new(new_hash_map()),
}
}