Skip to content

Commit 47abc36

Browse files
Bump to version 0.17.2 + misc (#661)
* retention bug fix upgrade logic (minor; see #657) * minor refactor for improved readability * trigger activation upper-bounds/after calcs for mainnet as well * align test with activation triggering (which moves tight parents limit check to in-context validation) * rothschild: add payload size config * rothschild: reduce compounding phase to 8 inputs for simulating more reasonable average behavior * bump version to 0.17.2
1 parent 2c99ea3 commit 47abc36

File tree

8 files changed

+181
-140
lines changed

8 files changed

+181
-140
lines changed

Cargo.lock

+60-59
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+57-57
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ members = [
6363

6464
[workspace.package]
6565
rust-version = "1.82.0"
66-
version = "0.17.1"
66+
version = "0.17.2"
6767
authors = ["Kaspa developers"]
6868
license = "ISC"
6969
repository = "https://github.com/kaspanet/rusty-kaspa"
@@ -80,62 +80,62 @@ include = [
8080
]
8181

8282
[workspace.dependencies]
83-
# kaspa-testing-integration = { version = "0.17.1", path = "testing/integration" }
84-
kaspa-addresses = { version = "0.17.1", path = "crypto/addresses" }
85-
kaspa-addressmanager = { version = "0.17.1", path = "components/addressmanager" }
86-
kaspa-bip32 = { version = "0.17.1", path = "wallet/bip32" }
87-
kaspa-cli = { version = "0.17.1", path = "cli" }
88-
kaspa-connectionmanager = { version = "0.17.1", path = "components/connectionmanager" }
89-
kaspa-consensus = { version = "0.17.1", path = "consensus" }
90-
kaspa-consensus-core = { version = "0.17.1", path = "consensus/core" }
91-
kaspa-consensus-client = { version = "0.17.1", path = "consensus/client" }
92-
kaspa-consensus-notify = { version = "0.17.1", path = "consensus/notify" }
93-
kaspa-consensus-wasm = { version = "0.17.1", path = "consensus/wasm" }
94-
kaspa-consensusmanager = { version = "0.17.1", path = "components/consensusmanager" }
95-
kaspa-core = { version = "0.17.1", path = "core" }
96-
kaspa-daemon = { version = "0.17.1", path = "daemon" }
97-
kaspa-database = { version = "0.17.1", path = "database" }
98-
kaspa-grpc-client = { version = "0.17.1", path = "rpc/grpc/client" }
99-
kaspa-grpc-core = { version = "0.17.1", path = "rpc/grpc/core" }
100-
kaspa-grpc-server = { version = "0.17.1", path = "rpc/grpc/server" }
101-
kaspa-hashes = { version = "0.17.1", path = "crypto/hashes" }
102-
kaspa-index-core = { version = "0.17.1", path = "indexes/core" }
103-
kaspa-index-processor = { version = "0.17.1", path = "indexes/processor" }
104-
kaspa-math = { version = "0.17.1", path = "math" }
105-
kaspa-merkle = { version = "0.17.1", path = "crypto/merkle" }
106-
kaspa-metrics-core = { version = "0.17.1", path = "metrics/core" }
107-
kaspa-mining = { version = "0.17.1", path = "mining" }
108-
kaspa-mining-errors = { version = "0.17.1", path = "mining/errors" }
109-
kaspa-muhash = { version = "0.17.1", path = "crypto/muhash" }
110-
kaspa-notify = { version = "0.17.1", path = "notify" }
111-
kaspa-p2p-flows = { version = "0.17.1", path = "protocol/flows" }
112-
kaspa-p2p-lib = { version = "0.17.1", path = "protocol/p2p" }
113-
kaspa-p2p-mining = { version = "0.17.1", path = "protocol/mining" }
114-
kaspa-perf-monitor = { version = "0.17.1", path = "metrics/perf_monitor" }
115-
kaspa-pow = { version = "0.17.1", path = "consensus/pow" }
116-
kaspa-rpc-core = { version = "0.17.1", path = "rpc/core" }
117-
kaspa-rpc-macros = { version = "0.17.1", path = "rpc/macros" }
118-
kaspa-rpc-service = { version = "0.17.1", path = "rpc/service" }
119-
kaspa-txscript = { version = "0.17.1", path = "crypto/txscript" }
120-
kaspa-txscript-errors = { version = "0.17.1", path = "crypto/txscript/errors" }
121-
kaspa-utils = { version = "0.17.1", path = "utils" }
122-
kaspa-utils-tower = { version = "0.17.1", path = "utils/tower" }
123-
kaspa-utxoindex = { version = "0.17.1", path = "indexes/utxoindex" }
124-
kaspa-wallet = { version = "0.17.1", path = "wallet/native" }
125-
kaspa-wallet-cli-wasm = { version = "0.17.1", path = "wallet/wasm" }
126-
kaspa-wallet-keys = { version = "0.17.1", path = "wallet/keys" }
127-
kaspa-wallet-pskt = { version = "0.17.1", path = "wallet/pskt" }
128-
kaspa-wallet-core = { version = "0.17.1", path = "wallet/core" }
129-
kaspa-wallet-macros = { version = "0.17.1", path = "wallet/macros" }
130-
kaspa-wasm = { version = "0.17.1", path = "wasm" }
131-
kaspa-wasm-core = { version = "0.17.1", path = "wasm/core" }
132-
kaspa-wrpc-client = { version = "0.17.1", path = "rpc/wrpc/client" }
133-
kaspa-wrpc-proxy = { version = "0.17.1", path = "rpc/wrpc/proxy" }
134-
kaspa-wrpc-server = { version = "0.17.1", path = "rpc/wrpc/server" }
135-
kaspa-wrpc-wasm = { version = "0.17.1", path = "rpc/wrpc/wasm" }
136-
kaspa-wrpc-example-subscriber = { version = "0.17.1", path = "rpc/wrpc/examples/subscriber" }
137-
kaspad = { version = "0.17.1", path = "kaspad" }
138-
kaspa-alloc = { version = "0.17.1", path = "utils/alloc" }
83+
# kaspa-testing-integration = { version = "0.17.2", path = "testing/integration" }
84+
kaspa-addresses = { version = "0.17.2", path = "crypto/addresses" }
85+
kaspa-addressmanager = { version = "0.17.2", path = "components/addressmanager" }
86+
kaspa-bip32 = { version = "0.17.2", path = "wallet/bip32" }
87+
kaspa-cli = { version = "0.17.2", path = "cli" }
88+
kaspa-connectionmanager = { version = "0.17.2", path = "components/connectionmanager" }
89+
kaspa-consensus = { version = "0.17.2", path = "consensus" }
90+
kaspa-consensus-core = { version = "0.17.2", path = "consensus/core" }
91+
kaspa-consensus-client = { version = "0.17.2", path = "consensus/client" }
92+
kaspa-consensus-notify = { version = "0.17.2", path = "consensus/notify" }
93+
kaspa-consensus-wasm = { version = "0.17.2", path = "consensus/wasm" }
94+
kaspa-consensusmanager = { version = "0.17.2", path = "components/consensusmanager" }
95+
kaspa-core = { version = "0.17.2", path = "core" }
96+
kaspa-daemon = { version = "0.17.2", path = "daemon" }
97+
kaspa-database = { version = "0.17.2", path = "database" }
98+
kaspa-grpc-client = { version = "0.17.2", path = "rpc/grpc/client" }
99+
kaspa-grpc-core = { version = "0.17.2", path = "rpc/grpc/core" }
100+
kaspa-grpc-server = { version = "0.17.2", path = "rpc/grpc/server" }
101+
kaspa-hashes = { version = "0.17.2", path = "crypto/hashes" }
102+
kaspa-index-core = { version = "0.17.2", path = "indexes/core" }
103+
kaspa-index-processor = { version = "0.17.2", path = "indexes/processor" }
104+
kaspa-math = { version = "0.17.2", path = "math" }
105+
kaspa-merkle = { version = "0.17.2", path = "crypto/merkle" }
106+
kaspa-metrics-core = { version = "0.17.2", path = "metrics/core" }
107+
kaspa-mining = { version = "0.17.2", path = "mining" }
108+
kaspa-mining-errors = { version = "0.17.2", path = "mining/errors" }
109+
kaspa-muhash = { version = "0.17.2", path = "crypto/muhash" }
110+
kaspa-notify = { version = "0.17.2", path = "notify" }
111+
kaspa-p2p-flows = { version = "0.17.2", path = "protocol/flows" }
112+
kaspa-p2p-lib = { version = "0.17.2", path = "protocol/p2p" }
113+
kaspa-p2p-mining = { version = "0.17.2", path = "protocol/mining" }
114+
kaspa-perf-monitor = { version = "0.17.2", path = "metrics/perf_monitor" }
115+
kaspa-pow = { version = "0.17.2", path = "consensus/pow" }
116+
kaspa-rpc-core = { version = "0.17.2", path = "rpc/core" }
117+
kaspa-rpc-macros = { version = "0.17.2", path = "rpc/macros" }
118+
kaspa-rpc-service = { version = "0.17.2", path = "rpc/service" }
119+
kaspa-txscript = { version = "0.17.2", path = "crypto/txscript" }
120+
kaspa-txscript-errors = { version = "0.17.2", path = "crypto/txscript/errors" }
121+
kaspa-utils = { version = "0.17.2", path = "utils" }
122+
kaspa-utils-tower = { version = "0.17.2", path = "utils/tower" }
123+
kaspa-utxoindex = { version = "0.17.2", path = "indexes/utxoindex" }
124+
kaspa-wallet = { version = "0.17.2", path = "wallet/native" }
125+
kaspa-wallet-cli-wasm = { version = "0.17.2", path = "wallet/wasm" }
126+
kaspa-wallet-keys = { version = "0.17.2", path = "wallet/keys" }
127+
kaspa-wallet-pskt = { version = "0.17.2", path = "wallet/pskt" }
128+
kaspa-wallet-core = { version = "0.17.2", path = "wallet/core" }
129+
kaspa-wallet-macros = { version = "0.17.2", path = "wallet/macros" }
130+
kaspa-wasm = { version = "0.17.2", path = "wasm" }
131+
kaspa-wasm-core = { version = "0.17.2", path = "wasm/core" }
132+
kaspa-wrpc-client = { version = "0.17.2", path = "rpc/wrpc/client" }
133+
kaspa-wrpc-proxy = { version = "0.17.2", path = "rpc/wrpc/proxy" }
134+
kaspa-wrpc-server = { version = "0.17.2", path = "rpc/wrpc/server" }
135+
kaspa-wrpc-wasm = { version = "0.17.2", path = "rpc/wrpc/wasm" }
136+
kaspa-wrpc-example-subscriber = { version = "0.17.2", path = "rpc/wrpc/examples/subscriber" }
137+
kaspad = { version = "0.17.2", path = "kaspad" }
138+
kaspa-alloc = { version = "0.17.2", path = "utils/alloc" }
139139

140140
# external
141141
aes = "0.8.3"

consensus/core/src/config/params.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@ pub const MAINNET_PARAMS: Params = Params {
539539
pruning_proof_m: 1000,
540540

541541
crescendo: CRESCENDO,
542-
crescendo_activation: ForkActivation::never(),
542+
// Temp: use a value which will trigger upper_bound/after calculations but is not actually scheduled.
543+
// We want the pre-release to test the influence of this change on mainnet nodes as well
544+
crescendo_activation: ForkActivation::new(u64::MAX - 1),
543545
};
544546

545547
pub const TESTNET_PARAMS: Params = Params {

consensus/src/model/stores/selected_chain.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub trait SelectedChainStoreReader {
2424
/// since chain index is not append-only and thus needs to be guarded.
2525
pub trait SelectedChainStore: SelectedChainStoreReader {
2626
fn apply_changes(&mut self, batch: &mut WriteBatch, changes: &ChainPath) -> StoreResult<()>;
27-
fn prune_below_pruning_point(&mut self, writer: impl DbWriter, pruning_point: Hash) -> StoreResult<()>;
27+
fn prune_below_point(&mut self, writer: impl DbWriter, block: Hash) -> StoreResult<()>;
2828
fn init_with_pruning_point(&mut self, batch: &mut WriteBatch, block: Hash) -> StoreResult<()>;
2929
}
3030

@@ -99,8 +99,8 @@ impl SelectedChainStore for DbSelectedChainStore {
9999
Ok(())
100100
}
101101

102-
fn prune_below_pruning_point(&mut self, mut writer: impl DbWriter, pruning_point: Hash) -> StoreResult<()> {
103-
let mut index = self.access_index_by_hash.read(pruning_point)?;
102+
fn prune_below_point(&mut self, mut writer: impl DbWriter, block: Hash) -> StoreResult<()> {
103+
let mut index = self.access_index_by_hash.read(block)?;
104104
while index > 0 {
105105
index -= 1;
106106
match self.access_hash_by_index.read(index.into()) {

consensus/src/pipeline/pruning_processor/processor.rs

+18-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::{
1515
pruning_samples::PruningSamplesStoreReader,
1616
reachability::{DbReachabilityStore, ReachabilityStoreReader, StagingReachabilityStore},
1717
relations::StagingRelationsStore,
18-
selected_chain::SelectedChainStore,
18+
selected_chain::{SelectedChainStore, SelectedChainStoreReader},
1919
statuses::StatusesStoreReader,
2020
tips::{TipsStore, TipsStoreReader},
2121
utxo_diffs::UtxoDiffsStoreReader,
@@ -383,7 +383,14 @@ impl PruningProcessor {
383383

384384
// Prune the selected chain index below the pruning point
385385
let mut selected_chain_write = self.selected_chain_store.write();
386-
selected_chain_write.prune_below_pruning_point(BatchDbWriter::new(&mut batch), retention_period_root).unwrap();
386+
// Temp — bug fix upgrade logic: the prev wrong logic might have pruned the new retention period root from the selected chain store,
387+
// hence we verify its existence first and only then proceed.
388+
// TODO (in upcoming versions): remove this temp condition
389+
if retention_period_root == new_pruning_point
390+
|| selected_chain_write.get_by_hash(retention_period_root).unwrap_option().is_some()
391+
{
392+
selected_chain_write.prune_below_point(BatchDbWriter::new(&mut batch), retention_period_root).unwrap();
393+
}
387394

388395
// Flush the batch to the DB
389396
self.db.write(batch).unwrap();
@@ -563,8 +570,7 @@ impl PruningProcessor {
563570
let retention_period_ms = (retention_period_days * 86400.0 * 1000.0).ceil() as u64;
564571

565572
// The target timestamp we would like to find a point below
566-
let sink_timestamp_as_current_time =
567-
self.headers_store.get_timestamp(self.lkg_virtual_state.load().ghostdag_data.selected_parent).unwrap();
573+
let sink_timestamp_as_current_time = self.get_sink_timestamp();
568574
let retention_period_root_ts_target = sink_timestamp_as_current_time.saturating_sub(retention_period_ms);
569575

570576
// Iterate from the new pruning point to the prev retention root and search for the first point with enough days above it.
@@ -595,6 +601,14 @@ impl PruningProcessor {
595601
}
596602
}
597603

604+
fn get_sink_timestamp(&self) -> u64 {
605+
self.headers_store.get_timestamp(self.get_sink()).unwrap()
606+
}
607+
608+
fn get_sink(&self) -> Hash {
609+
self.lkg_virtual_state.load().ghostdag_data.selected_parent
610+
}
611+
598612
fn past_pruning_points(&self) -> BlockHashSet {
599613
(0..self.pruning_point_store.read().get().unwrap().index)
600614
.map(|index| self.past_pruning_points_store.get(index).unwrap())

rothschild/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ faster-hex.workspace = true
2525
itertools.workspace = true
2626
log.workspace = true
2727
parking_lot.workspace = true
28+
rand.workspace = true
2829
rayon.workspace = true
2930
secp256k1 = { workspace = true, features = ["global-context", "rand-std"] }
3031
tokio = { workspace = true, features = ["rt", "macros", "rt-multi-thread"] }

rothschild/src/main.rs

+36-14
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use kaspa_notify::subscription::context::SubscriptionContext;
1616
use kaspa_rpc_core::{api::rpc::RpcApi, notify::mode::NotificationMode, RpcUtxoEntry};
1717
use kaspa_txscript::pay_to_address_script;
1818
use parking_lot::Mutex;
19+
use rand::RngCore;
1920
use rayon::prelude::*;
2021
use secp256k1::{
2122
rand::{thread_rng, Rng},
@@ -46,6 +47,7 @@ pub struct Args {
4647
pub addr: Option<String>,
4748
pub priority_fee: u64,
4849
pub randomize_fee: bool,
50+
pub payload_size: usize,
4951
}
5052

5153
impl Args {
@@ -60,6 +62,7 @@ impl Args {
6062
addr: m.get_one::<String>("addr").cloned(),
6163
priority_fee: m.get_one::<u64>("priority-fee").cloned().unwrap_or(0),
6264
randomize_fee: m.get_one::<bool>("randomize-fee").cloned().unwrap_or(false),
65+
payload_size: m.get_one::<usize>("payload-size").cloned().unwrap_or(0),
6366
}
6467
}
6568
}
@@ -113,6 +116,16 @@ pub fn cli() -> Command {
113116
.default_value("false")
114117
.help("Randomize transaction priority fee"),
115118
)
119+
.arg(
120+
Arg::new("payload-size")
121+
.long("payload-size")
122+
.short('p')
123+
.value_name("payload-size")
124+
.hide(true)
125+
.default_value("0")
126+
.value_parser(clap::value_parser!(usize))
127+
.help("Randomized payload size"),
128+
)
116129
}
117130

118131
async fn new_rpc_client(subscription_context: &SubscriptionContext, address: &str) -> GrpcClient {
@@ -139,9 +152,10 @@ struct ClientPoolArg {
139152
utxos_len: usize,
140153
}
141154

142-
struct TxsFeeConfig {
155+
struct TxConfig {
143156
priority_fee: u64,
144157
randomize_fee: bool,
158+
payload_size: usize,
145159
}
146160

147161
#[tokio::main]
@@ -187,7 +201,9 @@ async fn main() {
187201

188202
let kaspa_to_addr = args.addr.as_ref().map_or_else(|| kaspa_addr.clone(), |addr_str| Address::try_from(addr_str.clone()).unwrap());
189203

190-
let fee_config = TxsFeeConfig { priority_fee: args.priority_fee, randomize_fee: args.randomize_fee };
204+
(args.payload_size <= 20000).then_some(()).expect("payload-size can be max 20000");
205+
206+
let tx_config = TxConfig { priority_fee: args.priority_fee, randomize_fee: args.randomize_fee, payload_size: args.payload_size };
191207

192208
rayon::ThreadPoolBuilder::new().num_threads(args.threads as usize).build_global().unwrap();
193209

@@ -204,10 +220,13 @@ async fn main() {
204220
if args.priority_fee != 0 {
205221
log_message.push_str(&format!(
206222
"\n\tpriority fee: {} SOMPS {}",
207-
fee_config.priority_fee,
208-
if fee_config.randomize_fee { "[randomize]" } else { "" }
223+
tx_config.priority_fee,
224+
if tx_config.randomize_fee { "[randomize]" } else { "" }
209225
));
210226
}
227+
if args.payload_size != 0 {
228+
log_message.push_str(&format!("\n\tpayload size: {} random bytes", tx_config.payload_size,));
229+
}
211230
info!("{}", log_message);
212231

213232
let info = rpc_client.get_block_dag_info().await.expect("Failed to get block dag info.");
@@ -314,7 +333,7 @@ async fn main() {
314333
stats.clone(),
315334
maximize_inputs,
316335
&mut next_available_utxo_index,
317-
&fee_config,
336+
&tx_config,
318337
)
319338
.await;
320339
if !has_funds {
@@ -429,7 +448,7 @@ async fn maybe_send_tx(
429448
stats: Arc<Mutex<Stats>>,
430449
maximize_inputs: bool,
431450
next_available_utxo_index: &mut usize,
432-
fee_config: &TxsFeeConfig,
451+
tx_config: &TxConfig,
433452
) -> bool {
434453
let num_outs = if maximize_inputs { 1 } else { 2 };
435454

@@ -438,7 +457,7 @@ async fn maybe_send_tx(
438457
let selected_utxos_groups = (0..txs_to_send)
439458
.map(|_| {
440459
let (selected_utxos, selected_amount) =
441-
select_utxos(utxos, DEFAULT_SEND_AMOUNT, num_outs, maximize_inputs, next_available_utxo_index, fee_config);
460+
select_utxos(utxos, DEFAULT_SEND_AMOUNT, num_outs, maximize_inputs, next_available_utxo_index, tx_config);
442461
if selected_amount == 0 {
443462
return None;
444463
}
@@ -464,7 +483,7 @@ async fn maybe_send_tx(
464483
.into_par_iter()
465484
.map(|utxo_option| {
466485
if let Some((selected_utxos, selected_amount)) = utxo_option {
467-
let tx = generate_tx(schnorr_key, &selected_utxos, selected_amount, num_outs, &kaspa_addr);
486+
let tx = generate_tx(schnorr_key, &selected_utxos, selected_amount, num_outs, &kaspa_addr, tx_config.payload_size);
468487

469488
return Some((tx, selected_utxos.len(), selected_utxos.into_iter().map(|(_, entry)| entry.amount).sum::<u64>()));
470489
}
@@ -509,6 +528,7 @@ fn generate_tx(
509528
send_amount: u64,
510529
num_outs: u64,
511530
kaspa_addr: &Address,
531+
payload_size: usize,
512532
) -> Transaction {
513533
let script_public_key = pay_to_address_script(kaspa_addr);
514534
let inputs = utxos
@@ -519,7 +539,9 @@ fn generate_tx(
519539
let outputs = (0..num_outs)
520540
.map(|_| TransactionOutput { value: send_amount / num_outs, script_public_key: script_public_key.clone() })
521541
.collect_vec();
522-
let unsigned_tx = Transaction::new_non_finalized(TX_VERSION, inputs, outputs, 0, SUBNETWORK_ID_NATIVE, 0, vec![]);
542+
let mut data = vec![0u8; payload_size];
543+
rand::thread_rng().fill_bytes(&mut data);
544+
let unsigned_tx = Transaction::new_non_finalized(TX_VERSION, inputs, outputs, 0, SUBNETWORK_ID_NATIVE, 0, data);
523545
let signed_tx =
524546
sign(MutableTransaction::with_entries(unsigned_tx, utxos.iter().map(|(_, entry)| entry.clone()).collect_vec()), schnorr_key);
525547
signed_tx.tx
@@ -531,9 +553,9 @@ fn select_utxos(
531553
num_outs: u64,
532554
maximize_utxos: bool,
533555
next_available_utxo_index: &mut usize,
534-
fee_config: &TxsFeeConfig,
556+
tx_config: &TxConfig,
535557
) -> (Vec<(TransactionOutpoint, UtxoEntry)>, u64) {
536-
const MAX_UTXOS: usize = 84;
558+
const MAX_UTXOS: usize = 8;
537559
let mut selected_amount: u64 = 0;
538560
let mut selected = Vec::new();
539561
let mut rng = thread_rng();
@@ -544,10 +566,10 @@ fn select_utxos(
544566
selected.push((outpoint, entry));
545567

546568
let fee = required_fee(selected.len(), num_outs);
547-
let priority_fee = if fee_config.randomize_fee && fee_config.priority_fee > 0 {
548-
rng.gen_range(0..fee_config.priority_fee)
569+
let priority_fee = if tx_config.randomize_fee && tx_config.priority_fee > 0 {
570+
rng.gen_range(0..tx_config.priority_fee)
549571
} else {
550-
fee_config.priority_fee
572+
tx_config.priority_fee
551573
};
552574

553575
*next_available_utxo_index += 1;

testing/integration/src/consensus_integration_tests.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ async fn block_window_test() {
406406
#[tokio::test]
407407
async fn header_in_isolation_validation_test() {
408408
init_allocator_with_default_settings();
409-
let config = Config::new(MAINNET_PARAMS);
409+
let config = ConfigBuilder::new(MAINNET_PARAMS).edit_consensus_params(|p| p.skip_proof_of_work = true).build();
410410
let consensus = TestConsensus::new(&config);
411411
let wait_handles = consensus.init();
412412
let block = consensus.build_block_with_parents(1.into(), vec![config.genesis.hash]);
@@ -457,7 +457,8 @@ async fn header_in_isolation_validation_test() {
457457
{
458458
let mut block = block.clone();
459459
block.header.hash = 4.into();
460-
block.header.parents_by_level[0] = (5..(config.prior_max_block_parents + 6)).map(|x| (x as u64).into()).collect();
460+
block.header.parents_by_level[0] =
461+
std::iter::repeat(config.genesis.hash).take(config.prior_max_block_parents as usize + 1).collect();
461462
match consensus.validate_and_insert_block(block.to_immutable()).virtual_state_task.await {
462463
Err(RuleError::TooManyParents(num_parents, limit)) => {
463464
assert_eq!((config.prior_max_block_parents + 1) as usize, num_parents);

0 commit comments

Comments
 (0)