Skip to content

Commit

Permalink
Merge pull request #34 from xelis-project/dev
Browse files Browse the repository at this point in the history
Version 1.9.2
  • Loading branch information
Slixe committed Apr 23, 2024
2 parents 22f8804 + 968b910 commit bae2f65
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 25 deletions.
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion xelis_common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xelis_common"
version = "1.9.0"
version = "1.9.2"
edition = "2021"
authors = ["Slixe <slixeprivate@gmail.com>"]
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion xelis_daemon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xelis_daemon"
version = "1.9.0"
version = "1.9.2"
edition = "2021"
authors = ["Slixe <slixeprivate@gmail.com>"]

Expand Down
9 changes: 5 additions & 4 deletions xelis_daemon/src/core/state/chain_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use xelis_common::{
crypto::{
elgamal::Ciphertext,
Hash,
Hashable,
PublicKey
},
transaction::{
Expand Down Expand Up @@ -442,27 +443,27 @@ impl<'a, S: Storage> BlockchainVerificationState<'a, BlockchainError> for ChainS
) -> Result<(), BlockchainError> {
// Check the version
if tx.get_version() != 0 {
debug!("Invalid version: {}", tx.get_version());
debug!("Invalid version for tx {}: {}", tx.hash(), tx.get_version());
return Err(BlockchainError::InvalidTxVersion);
}

// Verified that minimal fees are set
let required_fees = blockchain::estimate_required_tx_fees(self.get_storage(), self.topoheight, tx).await?;
if required_fees > tx.get_fee() {
debug!("Invalid fees: {} required, {} provided", format_xelis(required_fees), format_xelis(tx.get_fee()));
debug!("Invalid fees for tx {}: {} required, {} provided", tx.hash(), format_xelis(required_fees), format_xelis(tx.get_fee()));
return Err(BlockchainError::InvalidTxFee(required_fees, tx.get_fee()));
}

let reference = tx.get_reference();
// Verify that the block he is built upon exists
if !self.storage.has_block_with_hash(&reference.hash).await? {
debug!("Invalid reference: block {} not found", reference.hash);
debug!("Invalid reference for tx {}: block {} not found", tx.hash(), reference.hash);
return Err(BlockchainError::InvalidReferenceHash);
}

// Verify that it is not a fake topoheight
if self.topoheight < reference.topoheight {
debug!("Invalid reference: topoheight {} is higher than chain {}", reference.topoheight, self.topoheight);
debug!("Invalid reference for tx {}: topoheight {} is higher than chain {}", tx.hash(), reference.topoheight, self.topoheight);
return Err(BlockchainError::InvalidReferenceTopoheight);
}

Expand Down
6 changes: 5 additions & 1 deletion xelis_daemon/src/core/storage/sled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,9 @@ impl Storage for SledStorage {

// save the new registration topoheight
self.registrations.insert(&key, &topoheight.to_be_bytes())?;

// Overwrite with the new topoheight
buf[0..8].copy_from_slice(&topoheight.to_be_bytes());
self.registrations_prefixed.insert(&buf, &[])?;
}
}
Expand Down Expand Up @@ -784,6 +787,7 @@ impl Storage for SledStorage {

// Delete the hash at topoheight
let (hash, block, block_txs) = self.delete_block_at_topoheight(topoheight).await?;
trace!("Block {} at topoheight {} deleted", hash, topoheight);
txs.extend(block_txs);

// generate new tips
Expand Down Expand Up @@ -900,7 +904,7 @@ impl Storage for SledStorage {
let pkey = PublicKey::from_bytes(&key[0..32])?;

let mut version = self.get_balance_at_exact_topoheight(&pkey, &asset, highest_topoheight).await
.context(format!("Error while retrieving balance at exact topoheight {highest_topoheight}"))?;
.context(format!("Error while retrieving balance at exact topoheight {highest_topoheight}"))?;

while let Some(previous_topoheight) = version.get_previous_topoheight() {
if previous_topoheight < topoheight {
Expand Down
2 changes: 1 addition & 1 deletion xelis_miner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xelis_miner"
version = "1.9.0"
version = "1.9.2"
edition = "2021"
authors = ["Slixe <slixeprivate@gmail.com>"]

Expand Down
2 changes: 1 addition & 1 deletion xelis_wallet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xelis_wallet"
version = "1.9.0"
version = "1.9.2"
edition = "2021"
authors = ["Slixe <slixeprivate@gmail.com>"]

Expand Down

0 comments on commit bae2f65

Please sign in to comment.