From 4ed00de8dfb66042199bd426b42844a0e10f27a8 Mon Sep 17 00:00:00 2001 From: mikera Date: Tue, 24 Dec 2024 15:38:29 +0000 Subject: [PATCH] Fix for peer timestamp handling --- CHANGELOG.md | 4 ++-- convex-core/src/main/java/convex/core/cvm/PeerStatus.java | 4 +--- convex-core/src/main/java/convex/core/cvm/State.java | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65d5ddbec..46255cddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Notable changes to Convex core modules will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.8.0] - 2024-12-20 - PROTONET +## [0.8.0] - 2024-12-24 - PROTONET ### Added @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `dissoc-in`, `update` and `update-in` core functions - `switch` conditional macro - Tagged values in Reader (e.g. `#Index {}`) -- `evict-peer` core function to remove old / understaked peers +- `evict-peer` core function to remove old / under-staked peers - Automatic distribution of rewards to peers / delegated stakers - Generalised CAD3 data support - Logging for fungible token transfer events diff --git a/convex-core/src/main/java/convex/core/cvm/PeerStatus.java b/convex-core/src/main/java/convex/core/cvm/PeerStatus.java index 3fe2b7c6b..663035740 100644 --- a/convex-core/src/main/java/convex/core/cvm/PeerStatus.java +++ b/convex-core/src/main/java/convex/core/cvm/PeerStatus.java @@ -346,13 +346,11 @@ protected ARecordGeneric withValues(AVector newValues) { return new PeerStatus(newValues); } - public PeerStatus distributeBlockReward(State state, long peerFees) { + public PeerStatus distributeBlockReward(State state, long peerFees, long newTime) { PeerStatus ps=addReward(peerFees); long oldTime=ps.getTimestamp(); // Maybe bump timestamp - CVMLong timestamp=state.getTimestamp(); - long newTime=timestamp.longValue(); if (oldTime