validator: properly initialize and verify genesis block monotree

This commit is contained in:
skoupidi
2025-08-27 15:08:12 +03:00
parent c4cb258cf6
commit a140ae53b1
9 changed files with 19 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ darkfi = {path = "../../../", features = ["bs58", "validator"]}
darkfi_money_contract = {path = "../../../src/contract/money", features = ["no-entrypoint", "client"]}
darkfi-contract-test-harness = {path = "../../../src/contract/test-harness"}
darkfi-sdk = {path = "../../../src/sdk"}
darkfi-serial = "0.5.0"
darkfi-serial = "0.5.1"
# Misc
bs58 = "0.5.1"

View File

@@ -170,7 +170,8 @@ fn main() -> Result<()> {
genesis_block.header.transactions_root = tree.root(0).unwrap();
// Grab the updated contracts states root
let state_monotree = overlay.lock().unwrap().get_state_monotree()?;
let mut state_monotree = overlay.lock().unwrap().get_state_monotree()?;
overlay.lock().unwrap().contracts.update_state_monotree(&mut state_monotree)?;
let Some(state_root) = state_monotree.get_headroot()? else {
return Err(Error::ContractsStatesRootNotFoundError);
};