Struct Config

Source
pub struct Config {
Show 27 fields pub disable_dns_seeds: bool, pub data_dir: Option<String>, pub assume_valid: Option<String>, pub wallet_xpub: Option<Vec<String>>, pub wallet_descriptor: Option<Vec<String>>, pub config_file: Option<String>, pub proxy: Option<String>, pub network: Network, pub cfilters: bool, pub filters_start_height: Option<i32>, pub zmq_address: Option<String>, pub connect: Option<String>, pub json_rpc_address: Option<String>, pub log_to_stdout: bool, pub log_to_file: bool, pub assume_utreexo: bool, pub debug: bool, pub user_agent: String, pub assumeutreexo_value: Option<AssumeUtreexoValue>, pub electrum_address: Option<String>, pub enable_electrum_tls: bool, pub electrum_address_tls: Option<String>, pub tls_key_path: Option<String>, pub tls_cert_path: Option<String>, pub generate_cert: bool, pub allow_v1_fallback: bool, pub backfill: bool,
}
Expand description

General configuration for the floresta daemon.

Those configs should be passed in by anyone that wants to start a floresta instance. Some of these are also exposed through the config file.

Fields§

§disable_dns_seeds: bool

Whether we should disable dns seeds

§data_dir: Option<String>

Where we should place our data

This directory must be readable and writable by our process. We’ll use this dir to store both chain and wallet data, so this should be kept in a non-volatile medium. We are not particularly aggressive in disk usage, so we don’t need a fast disk to work.

If not set, it defaults to $HOME/.floresta

§assume_valid: Option<String>

We consider blocks prior to this one to have a valid signature

This is an optimization mirrored from Core, where blocks before this one are considered to have valid signatures. The idea here is that if a block is buried under a lot of PoW, it’s very unlikely that it is invalid. We still validate everything else and build the accumulator until this point (unless running on PoW-fraud proof or assumeutreexo mode) so there’s still some work to do.

§wallet_xpub: Option<Vec<String>>

A vector of xpubs to cache

This is a list of SLIP-132-encoded extended public key that we should add to our Watch-only wallet. A descriptor may be only passed one time, if you call florestad with an already cached address, that will be a no-op. After a xpub is cached, we derive multiple addresses from it and try to find transactions involving it.

§wallet_descriptor: Option<Vec<String>>

An output descriptor to cache

This should be a list of output descriptors that we should add to our watch-only wallet. This works just like wallet_xpub, but with a descriptor.

§config_file: Option<String>

Where should we read from a config file

This is a toml-encoded file with floresta’s configs. For a sample of how this file looks like, see config.toml.sample inside floresta’s codebase.

If a setting is modified by the config file and this config struct, the following logic is used: - For vectors, we use the combination of both vectors - for mutually exclusive options, this struct has precedence over the config file

§proxy: Option<String>

A proxy that we should use to connect with others

This should be a socks5 proxy, like Tor’s socks. If provided, all our outgoing connections will be made through this one, except dns seed connections.

§network: Network

The network we are running in, it may be one of: bitcoin, signet, regtest or testnet.

§cfilters: bool

Whether we should build and store compact block filters

Those filters are used for rescanning our wallet for historical transactions. If you don’t have this on, the only way to find historical transactions is to download all blocks, which is very inefficient and resource/time consuming. But keep in mind that filters will take up disk space.

§filters_start_height: Option<i32>

If we are using block filters, we may not need to download the whole chain of filters, as our wallets may not have been created at the beginning of the chain. With this option, we can make a rough estimate of the block height we need to start downloading filters.

If the value is negative, it’s relative to the current tip. For example, if the current tip is at height 1000, and we set this value to -100, we will start downloading filters from height 900.

§zmq_address: Option<String>
Available on crate feature zmq-server only.

The address to listen to for our ZMQ server

We have an (optional) ZMQ server, that pushes new blocks over a PUSH/PULL ZMQ queue, this is the address that we’ll listen for incoming connections.

§connect: Option<String>§json_rpc_address: Option<String>
Available on crate feature json-rpc only.

The address our json-rpc should listen to

§log_to_stdout: bool

Whether we should write logs to stdout.

§log_to_file: bool

Whether we should log to a fs file

§assume_utreexo: bool

Whether we should use assume utreexo

§debug: bool

Whether we should post debug information to the console

§user_agent: String

The user agent that we will advertise to our peers

§assumeutreexo_value: Option<AssumeUtreexoValue>

The value to use for assumeutreexo

§electrum_address: Option<String>

Address the Electrum Server will listen to.

§enable_electrum_tls: bool

Whether to enable the Electrum TLS server.

§electrum_address_tls: Option<String>

Address the Electrum TLS Server will listen to.

§tls_key_path: Option<String>

TLS private key path (defaults to {data_dir}/tls/key.pem). It must be PKCS#8-encoded. You can use openssl to generate it:

openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048
§tls_cert_path: Option<String>

TLS certificate path (defaults to {data_dir}/tls/cert.pem). It must be PKCS#8-encoded. You can use openssl to generate it from a PKCS#8-encoded private key:

openssl req -x509 -new -key key.pem -out cert.pem -days 365 -subj "/CN=localhost"
§generate_cert: bool

Whether to create self signed certificate for tls_key_path and tls_cert_path.

§allow_v1_fallback: bool

Whether to allow fallback to v1 transport if v2 connection fails.

§backfill: bool

Whehter we should backfill

If we assumeutreexo or use pow fraud proofs, you have the option to download and validate the blocks that were skipped. This will take a long time, but will run on the background and won’t affect the node’s operation. You may notice that this will take a lot of CPU and bandwidth to run.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Config> for Florestad

Source§

fn from(config: Config) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more