Skip to content

Commit

Permalink
refactor: update estimated tx size consts
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Jul 30, 2024
1 parent df7e9e1 commit eb80166
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ use super::super::operations::BurnchainOpSigner;
use super::super::Config;
use super::{BurnchainController, BurnchainTip, Error as BurnchainControllerError};
use crate::config::{
BurnchainConfig, OP_TX_BLOCK_COMMIT_ESTIM_SIZE, OP_TX_DELEGATE_STACKS_ESTIM_SIZE,
OP_TX_PRE_STACKS_ESTIM_SIZE, OP_TX_STACK_STX_ESTIM_SIZE, OP_TX_TRANSFER_STACKS_ESTIM_SIZE,
OP_TX_VOTE_AGG_ESTIM_SIZE,
BurnchainConfig, OP_TX_ANY_ESTIM_SIZE, OP_TX_BLOCK_COMMIT_ESTIM_SIZE,
OP_TX_DELEGATE_STACKS_ESTIM_SIZE, OP_TX_PRE_STACKS_ESTIM_SIZE, OP_TX_STACK_STX_ESTIM_SIZE,
OP_TX_TRANSFER_STACKS_ESTIM_SIZE, OP_TX_VOTE_AGG_ESTIM_SIZE,
};

/// The number of bitcoin blocks that can have
Expand Down Expand Up @@ -1210,7 +1210,7 @@ impl BitcoinRegtestController {
let public_key = signer.get_public_key();
let max_tx_size = OP_TX_PRE_STACKS_ESTIM_SIZE;

let max_tx_size_any_op = 380;
let max_tx_size_any_op = OP_TX_ANY_ESTIM_SIZE;
let output_amt = DUST_UTXO_LIMIT + max_tx_size_any_op * get_satoshis_per_byte(&self.config);

let (mut tx, mut utxos) =
Expand Down
18 changes: 14 additions & 4 deletions testnet/stacks-node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,23 @@ use stacks_common::util::secp256k1::{Secp256k1PrivateKey, Secp256k1PublicKey};
use crate::chain_data::MinerStats;

pub const DEFAULT_SATS_PER_VB: u64 = 50;
pub const OP_TX_LEADER_KEY_ESTIM_SIZE: u64 = 290;
pub const OP_TX_BLOCK_COMMIT_ESTIM_SIZE: u64 = 350;
pub const OP_TX_TRANSFER_STACKS_ESTIM_SIZE: u64 = 230;
pub const OP_TX_BLOCK_COMMIT_ESTIM_SIZE: u64 = 380;
pub const OP_TX_DELEGATE_STACKS_ESTIM_SIZE: u64 = 230;
pub const OP_TX_VOTE_AGG_ESTIM_SIZE: u64 = 230;
pub const OP_TX_LEADER_KEY_ESTIM_SIZE: u64 = 290;
pub const OP_TX_PRE_STACKS_ESTIM_SIZE: u64 = 280;
pub const OP_TX_STACK_STX_ESTIM_SIZE: u64 = 250;
pub const OP_TX_TRANSFER_STACKS_ESTIM_SIZE: u64 = 230;
pub const OP_TX_VOTE_AGG_ESTIM_SIZE: u64 = 230;

pub const OP_TX_ANY_ESTIM_SIZE: u64 = fmax!(
OP_TX_BLOCK_COMMIT_ESTIM_SIZE,
OP_TX_DELEGATE_STACKS_ESTIM_SIZE,
OP_TX_LEADER_KEY_ESTIM_SIZE,
OP_TX_PRE_STACKS_ESTIM_SIZE,
OP_TX_STACK_STX_ESTIM_SIZE,
OP_TX_TRANSFER_STACKS_ESTIM_SIZE,
OP_TX_VOTE_AGG_ESTIM_SIZE
);

const DEFAULT_MAX_RBF_RATE: u64 = 150; // 1.5x
const DEFAULT_RBF_FEE_RATE_INCREMENT: u64 = 5;
Expand Down

0 comments on commit eb80166

Please sign in to comment.