pub struct SimpleValidator { /* private fields */ }
Expand description

A simple validator. See SimpleValidatorFactory for construction

Trait Implementations§

source§

impl Validator for SimpleValidator

source§

fn validate_payment_balance( &self, incoming_msat: u64, outgoing_msat: u64, invoiced_amount_msat: Option<u64> ) -> Result<(), ValidationError>

When thinking about payment routing and balance, it is useful to consider three cases:

  1. When invoiced_amount_msat is specified and the incoming_msat is 0; e.g. we are paying an invoice and there is no loop in the routing through us
  2. When invoiced_amount_msat is specified and the incoming_msat is not 0; e.g. we are paying an invoice and there is a loop in the routing that includes us
  3. When no invoiced_amount_msat is specified and the incoming_msat is not 0; e.g forwarding a payment.
source§

fn validate_setup_channel( &self, wallet: &dyn Wallet, setup: &ChannelSetup, holder_shutdown_key_path: &[u32] ) -> Result<(), ValidationError>

Validate ready channel parameters. The holder_shutdown_key_path should be an empty vector if the setup.holder_shutdown_script is not set or the address is in the allowlist.
source§

fn validate_channel_value( &self, setup: &ChannelSetup ) -> Result<(), ValidationError>

Validate channel value after it is late-filled
source§

fn validate_onchain_tx( &self, wallet: &dyn Wallet, channels: Vec<Option<Arc<Mutex<ChannelSlot>>>>, tx: &Transaction, segwit_flags: &[bool], values_sat: &[u64], opaths: &[Vec<u32>], weight_lower_bound: usize ) -> Result<u64, ValidationError>

Validate an onchain transaction (funding tx, simple sweeps). This transaction may fund multiple channels at the same time. Read more
source§

fn decode_commitment_tx( &self, keys: &InMemorySigner, setup: &ChannelSetup, is_counterparty: bool, tx: &Transaction, output_witscripts: &[Vec<u8>] ) -> Result<CommitmentInfo, ValidationError>

Phase 1 CommitmentInfo
source§

fn validate_counterparty_commitment_tx( &self, estate: &EnforcementState, commit_num: u64, commitment_point: &PublicKey, setup: &ChannelSetup, cstate: &ChainState, info2: &CommitmentInfo2 ) -> Result<(), ValidationError>

Validate a counterparty commitment
source§

fn validate_holder_commitment_tx( &self, estate: &EnforcementState, commit_num: u64, commitment_point: &PublicKey, setup: &ChannelSetup, cstate: &ChainState, info2: &CommitmentInfo2 ) -> Result<(), ValidationError>

Validate a holder commitment
source§

fn validate_counterparty_revocation( &self, state: &EnforcementState, revoke_num: u64, commitment_secret: &SecretKey ) -> Result<(), ValidationError>

Check a counterparty’s revocation of an old state. This also makes a note that the counterparty has committed to their current commitment transaction.
source§

fn decode_and_validate_htlc_tx( &self, is_counterparty: bool, setup: &ChannelSetup, txkeys: &TxCreationKeys, tx: &Transaction, redeemscript: &Script, htlc_amount_sat: u64, output_witscript: &Script ) -> Result<(u32, HTLCOutputInCommitment, Sighash, EcdsaSighashType), ValidationError>

Phase 1 decoding of 2nd level HTLC tx and validation by recomposition
source§

fn validate_htlc_tx( &self, setup: &ChannelSetup, _cstate: &ChainState, _is_counterparty: bool, htlc: &HTLCOutputInCommitment, feerate_per_kw: u32 ) -> Result<(), ValidationError>

Phase 2 validation of 2nd level HTLC tx
source§

fn decode_and_validate_mutual_close_tx( &self, wallet: &dyn Wallet, setup: &ChannelSetup, estate: &EnforcementState, tx: &Transaction, wallet_paths: &[Vec<u32>] ) -> Result<ClosingTransaction, ValidationError>

Phase 1 decoding and recomposition of mutual_close
source§

fn validate_mutual_close_tx( &self, wallet: &dyn Wallet, setup: &ChannelSetup, estate: &EnforcementState, to_holder_value_sat: u64, to_counterparty_value_sat: u64, holder_script: &Option<Script>, counterparty_script: &Option<Script>, holder_wallet_path_hint: &[u32] ) -> Result<(), ValidationError>

Phase 2 Validatation of mutual_close
source§

fn validate_delayed_sweep( &self, wallet: &dyn Wallet, setup: &ChannelSetup, cstate: &ChainState, tx: &Transaction, input: usize, amount_sat: u64, wallet_path: &[u32] ) -> Result<(), ValidationError>

Validation of delayed sweep transaction
source§

fn validate_counterparty_htlc_sweep( &self, wallet: &dyn Wallet, setup: &ChannelSetup, cstate: &ChainState, tx: &Transaction, redeemscript: &Script, input: usize, amount_sat: u64, wallet_path: &[u32] ) -> Result<(), ValidationError>

Validation of counterparty htlc sweep transaction (first level commitment htlc outputs)
source§

fn validate_justice_sweep( &self, wallet: &dyn Wallet, _setup: &ChannelSetup, cstate: &ChainState, tx: &Transaction, input: usize, amount_sat: u64, wallet_path: &[u32] ) -> Result<(), ValidationError>

Validation of justice sweep transaction
source§

fn enforce_balance(&self) -> bool

Whether the policy specifies that holder balance should be tracked and enforced.
source§

fn minimum_initial_balance(&self, holder_value_msat: u64) -> u64

The minimum initial commitment transaction balance to us, given the funding amount. The result is in satoshi.
source§

fn policy(&self) -> Box<&dyn Policy>

The associated policy
source§

fn set_next_holder_commit_num( &self, estate: &mut EnforcementState, num: u64, current_commitment_info: CommitmentInfo2, counterparty_signatures: CommitmentSignatures ) -> Result<(), ValidationError>

Set next holder commitment number
source§

fn get_current_holder_commitment_info( &self, estate: &mut EnforcementState, commitment_number: u64 ) -> Result<CommitmentInfo2, ValidationError>

Get the current commitment info
source§

fn set_next_counterparty_commit_num( &self, estate: &mut EnforcementState, num: u64, current_point: PublicKey, current_commitment_info: CommitmentInfo2 ) -> Result<(), ValidationError>

Set next counterparty commitment number
source§

fn set_next_counterparty_revoke_num( &self, estate: &mut EnforcementState, num: u64 ) -> Result<(), ValidationError>

Set next counterparty revoked commitment number
source§

fn validate_block( &self, proof: &TxoProof, height: u32, header: &BlockHeader, external_block_hash: Option<&BlockHash>, prev_filter_header: &FilterHeader, outpoint_watches: &[OutPoint] ) -> Result<(), ValidationError>

Validate a block and a TXOO proof for spent/unspent watched outputs
source§

fn validate_invoice( &self, invoice: &Invoice, now: Duration ) -> Result<(), ValidationError>

Validate an invoice

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V