Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Release v0.1.4 #18

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ book
index.html

# Test data
nohup.out
test/integration/data
test/integration/secret.toml
2 changes: 1 addition & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "GPL-3.0"
name = "slothunter"
readme = "README.md"
repository = "https://github.com/hack-ink/slothunter"
version = "0.1.3"
version = "0.1.4"

[features]
node-test = []
Expand Down
16 changes: 11 additions & 5 deletions src/hunter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,15 @@ impl Hunter {

has_bid = false;

Self::next_block(&mut block_stream).await?;
let b = Self::next_block(&mut block_stream).await?;

Self::next_block(&mut block_stream).await?
dbg!(b.number());

let b1 = Self::next_block(&mut block_stream).await?;

dbg!(b1.number());

b1
} else {
Self::next_block(&mut block_stream).await?
};
Expand Down Expand Up @@ -328,7 +334,7 @@ impl Hunter {
) -> Result<()> {
let Some(auction) = &self.auction else { return Ok(()) };

self.check_lease(auction.first_lease_period);
self.check_leases(auction.first_lease_period);

let end_at = auction.ending_period_start_at + self.auction_ending_period;

Expand All @@ -348,7 +354,7 @@ impl Hunter {
self.analyze_winners(block_height, &block_hash, auction, &winning, self_bid, has_bid).await
}

fn check_lease(&self, first_lease_period: u32) {
fn check_leases(&self, first_lease_period: u32) {
const E_INVALID_LEASES: &str = "invalid leases configuration";

let c_first = self.configuration.bid.leases.0;
Expand All @@ -361,7 +367,7 @@ impl Hunter {
"{E_INVALID_LEASES}, available range(#{first}, #{last}) but found range(#{c_first}, #{c_last})"
);
assert!(
c_last >= last,
c_last <= last,
"{E_INVALID_LEASES}, available range(#{first}, #{last}) but found range(#{c_first}, #{c_last})"
);
}
Expand Down