pub struct TestChannelSigner {
pub inner: InMemorySigner,
pub state: Arc<Mutex<EnforcementState>>,
pub disable_revocation_policy_check: bool,
}
Expand description
An implementation of Sign that enforces some policy checks. The current checks are an incomplete set. They include:
- When signing, the holder transaction has not been revoked
- When revoking, the holder transaction has not been signed
- The holder commitment number is monotonic and without gaps
- The revoked holder commitment number is monotonic and without gaps
- There is at least one unrevoked holder transaction at all times
- The counterparty commitment number is monotonic and without gaps
- The pre-derived keys and pre-built transaction in CommitmentTransaction were correctly built
Eventually we will probably want to expose a variant of this which would essentially be what you’d want to run on a hardware wallet.
Note that counterparty signatures on the holder transaction are not checked, but it should be in a complete implementation.
Note that before we do so we should ensure its serialization format has backwards- and forwards-compatibility prefix/suffixes!
Fields§
§inner: InMemorySigner
§state: Arc<Mutex<EnforcementState>>
Channel state used for policy enforcement
disable_revocation_policy_check: bool
Implementations§
§impl TestChannelSigner
impl TestChannelSigner
pub fn new(inner: InMemorySigner) -> TestChannelSigner
pub fn new(inner: InMemorySigner) -> TestChannelSigner
Construct an TestChannelSigner
pub fn new_with_revoked(
inner: InMemorySigner,
state: Arc<Mutex<EnforcementState>>,
disable_revocation_policy_check: bool,
) -> TestChannelSigner
pub fn new_with_revoked( inner: InMemorySigner, state: Arc<Mutex<EnforcementState>>, disable_revocation_policy_check: bool, ) -> TestChannelSigner
Construct an TestChannelSigner with externally managed storage
Since there are multiple copies of this struct for each channel, some coordination is needed so that all copies are aware of enforcement state. A pointer to this state is provided here, usually by an implementation of KeysInterface.
pub fn channel_type_features(&self) -> &Features<ChannelTypeContext>
Trait Implementations§
§impl ChannelSigner for TestChannelSigner
impl ChannelSigner for TestChannelSigner
§fn get_per_commitment_point(
&self,
idx: u64,
secp_ctx: &Secp256k1<All>,
) -> PublicKey
fn get_per_commitment_point( &self, idx: u64, secp_ctx: &Secp256k1<All>, ) -> PublicKey
§fn release_commitment_secret(&self, idx: u64) -> [u8; 32]
fn release_commitment_secret(&self, idx: u64) -> [u8; 32]
§fn validate_holder_commitment(
&self,
holder_tx: &HolderCommitmentTransaction,
_preimages: Vec<PaymentPreimage>,
) -> Result<(), ()>
fn validate_holder_commitment( &self, holder_tx: &HolderCommitmentTransaction, _preimages: Vec<PaymentPreimage>, ) -> Result<(), ()>
§fn pubkeys(&self) -> &ChannelPublicKeys
fn pubkeys(&self) -> &ChannelPublicKeys
§fn channel_keys_id(&self) -> [u8; 32]
fn channel_keys_id(&self) -> [u8; 32]
SpendableOutputDescriptor
types. This should be sufficient to identify this
EcdsaChannelSigner
object uniquely and lookup or re-derive its keys.§fn provide_channel_parameters(
&mut self,
channel_parameters: &ChannelTransactionParameters,
)
fn provide_channel_parameters( &mut self, channel_parameters: &ChannelTransactionParameters, )
counterparty_selected
/holder_selected_contest_delay
and funding outpoint. Read more§impl Clone for TestChannelSigner
impl Clone for TestChannelSigner
§fn clone(&self) -> TestChannelSigner
fn clone(&self) -> TestChannelSigner
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl EcdsaChannelSigner for TestChannelSigner
impl EcdsaChannelSigner for TestChannelSigner
§fn sign_counterparty_commitment(
&self,
commitment_tx: &CommitmentTransaction,
preimages: Vec<PaymentPreimage>,
secp_ctx: &Secp256k1<All>,
) -> Result<(Signature, Vec<Signature>), ()>
fn sign_counterparty_commitment( &self, commitment_tx: &CommitmentTransaction, preimages: Vec<PaymentPreimage>, secp_ctx: &Secp256k1<All>, ) -> Result<(Signature, Vec<Signature>), ()>
§fn validate_counterparty_revocation(
&self,
idx: u64,
_secret: &SecretKey,
) -> Result<(), ()>
fn validate_counterparty_revocation( &self, idx: u64, _secret: &SecretKey, ) -> Result<(), ()>
§fn sign_holder_commitment(
&self,
commitment_tx: &HolderCommitmentTransaction,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn sign_holder_commitment( &self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
§fn unsafe_sign_holder_commitment(
&self,
commitment_tx: &HolderCommitmentTransaction,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn unsafe_sign_holder_commitment( &self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
sign_holder_commitment
], but exists only for tests to get access to holder
commitment transactions which will be broadcasted later, after the channel has moved on to a
newer state. Thus, needs its own method as [sign_holder_commitment
] may enforce that we
only ever get called once.§fn sign_justice_revoked_output(
&self,
justice_tx: &Transaction,
input: usize,
amount: u64,
per_commitment_key: &SecretKey,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn sign_justice_revoked_output( &self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
to_local
output when our counterparty broadcasts an old state. Read more§fn sign_justice_revoked_htlc(
&self,
justice_tx: &Transaction,
input: usize,
amount: u64,
per_commitment_key: &SecretKey,
htlc: &HTLCOutputInCommitment,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn sign_justice_revoked_htlc( &self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
§fn sign_holder_htlc_transaction(
&self,
htlc_tx: &Transaction,
input: usize,
htlc_descriptor: &HTLCDescriptor,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn sign_holder_htlc_transaction( &self, htlc_tx: &Transaction, input: usize, htlc_descriptor: &HTLCDescriptor, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
htlc_tx
, which spends the commitment transaction at index input
. The signature returned
must be be computed using EcdsaSighashType::All
. Read more§fn sign_counterparty_htlc_transaction(
&self,
htlc_tx: &Transaction,
input: usize,
amount: u64,
per_commitment_point: &PublicKey,
htlc: &HTLCOutputInCommitment,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn sign_counterparty_htlc_transaction( &self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
§fn sign_closing_transaction(
&self,
closing_tx: &ClosingTransaction,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn sign_closing_transaction( &self, closing_tx: &ClosingTransaction, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
§fn sign_holder_anchor_input(
&self,
anchor_tx: &Transaction,
input: usize,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn sign_holder_anchor_input( &self, anchor_tx: &Transaction, input: usize, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
anchor_tx
, which spends the commitment transaction, at index input
.§fn sign_channel_announcement_with_funding_key(
&self,
msg: &UnsignedChannelAnnouncement,
secp_ctx: &Secp256k1<All>,
) -> Result<Signature, ()>
fn sign_channel_announcement_with_funding_key( &self, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>
§impl PartialEq for TestChannelSigner
impl PartialEq for TestChannelSigner
§impl<'a> Watch<TestChannelSigner> for TestChainMonitor<'a>
impl<'a> Watch<TestChannelSigner> for TestChainMonitor<'a>
§fn watch_channel(
&self,
funding_txo: OutPoint,
monitor: ChannelMonitor<TestChannelSigner>,
) -> Result<ChannelMonitorUpdateStatus, ()>
fn watch_channel( &self, funding_txo: OutPoint, monitor: ChannelMonitor<TestChannelSigner>, ) -> Result<ChannelMonitorUpdateStatus, ()>
§fn update_channel(
&self,
funding_txo: OutPoint,
update: &ChannelMonitorUpdate,
) -> ChannelMonitorUpdateStatus
fn update_channel( &self, funding_txo: OutPoint, update: &ChannelMonitorUpdate, ) -> ChannelMonitorUpdateStatus
§fn release_pending_monitor_events(
&self,
) -> Vec<(OutPoint, Vec<MonitorEvent>, Option<PublicKey>)>
fn release_pending_monitor_events( &self, ) -> Vec<(OutPoint, Vec<MonitorEvent>, Option<PublicKey>)>
§impl Writeable for TestChannelSigner
impl Writeable for TestChannelSigner
impl WriteableEcdsaChannelSigner for TestChannelSigner
Auto Trait Implementations§
impl !Freeze for TestChannelSigner
impl RefUnwindSafe for TestChannelSigner
impl Send for TestChannelSigner
impl Sync for TestChannelSigner
impl Unpin for TestChannelSigner
impl UnwindSafe for TestChannelSigner
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any
.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request