2022-10-31 17:43:45 -07:00
|
|
|
//! Mining config
|
|
|
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2022-11-09 16:12:27 -08:00
|
|
|
use zebra_chain::transparent;
|
2022-10-31 17:43:45 -07:00
|
|
|
|
|
|
|
/// Mining configuration section.
|
2023-02-22 16:10:11 -08:00
|
|
|
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
|
2022-10-31 17:43:45 -07:00
|
|
|
#[serde(deny_unknown_fields, default)]
|
|
|
|
pub struct Config {
|
|
|
|
/// The address used for miner payouts.
|
2022-12-08 21:17:55 -08:00
|
|
|
/// Zebra currently only supports P2SH and P2PKH transparent addresses.
|
2022-10-31 17:43:45 -07:00
|
|
|
///
|
|
|
|
/// Zebra sends mining fees and miner rewards to this address in the
|
|
|
|
/// `getblocktemplate` RPC coinbase transaction.
|
2022-11-09 16:12:27 -08:00
|
|
|
pub miner_address: Option<transparent::Address>,
|
2023-02-22 16:10:11 -08:00
|
|
|
|
|
|
|
/// Extra data to include in coinbase transaction inputs.
|
|
|
|
/// Limited to around 95 bytes by the consensus rules.
|
|
|
|
///
|
|
|
|
/// If this string is hex-encoded, it will be hex-decoded into bytes.
|
|
|
|
/// Otherwise, it will be UTF-8 encoded into bytes.
|
|
|
|
pub extra_coinbase_data: Option<String>,
|
|
|
|
|
|
|
|
/// Should Zebra's block templates try to imitate `zcashd`?
|
|
|
|
///
|
|
|
|
/// This developer-only config is not supported for general use.
|
|
|
|
pub debug_like_zcashd: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for Config {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
miner_address: None,
|
|
|
|
// For now, act like `zcashd` as much as possible.
|
|
|
|
// TODO: do we want to default to v5 transactions and Zebra coinbase data?
|
|
|
|
extra_coinbase_data: None,
|
|
|
|
debug_like_zcashd: true,
|
|
|
|
}
|
|
|
|
}
|
2022-10-31 17:43:45 -07:00
|
|
|
}
|