Skip to content

Cluster Start/Stop improvements - #127

Merged
zhaohong merged 3 commits into
tronprotocol:developfrom
Rovak:cluster-shutdown
Feb 15, 2018
Merged

zhaohong merged 3 commits into
tronprotocol:developfrom
Rovak:cluster-shutdown

Conversation

@Rovak

@Rovak Rovak commented Feb 13, 2018 •

Copy link
Copy Markdown
Contributor

What does this PR do?

  1. Improve starting and stopping Cluster logic
  2. Cleanup subscriptions when stopping gossip node

Why are these changes required?

  1. After stopping the gossip node it would be impossible to rejoin the cluster by calling start because joining was only done in the constructor
  2. The RX Java subscriptions were not disposed and would leak after stopping the cluster. I'm assuming cluster.shutdown() does not close the rx.Observables and i could not find it anywhere in the documentation that it completes the stream on shutdown.

This PR has been tested by:

This has not been tested, i need to setup a cluster to be able to fully test this.

Notes

In this PR i need to verify if the CompositeSubscription is required, maybe the cluster.shutdown() already completes the subscriptions

@zhaohong
zhaohong merged commit 9f3f12d into tronprotocol:develop Feb 15, 2018
@Rovak Rovak changed the title [Work In Progress] Cluster Start/Stop improvements Cluster Start/Stop improvements Feb 15, 2018
0xNebulaLumina referenced this pull request in 0xNebulaLumina/java-tron Mar 8, 2026
…127)

Add three parity fixes for UNFREEZE_BALANCE_CONTRACT:

1. Call withdrawReward before unfreeze mutation (freeze.rs):
   - Reuses compute_delegation_reward_if_enabled from withdraw.rs
   - Adds delegation reward to Account.allowance via adjustAllowance
   - Gated by delegation_reward_enabled config flag

2. Add convert() calls before undelegate_v1_optimized (freeze.rs):
   - When ALLOW_DELEGATE_OPTIMIZATION is enabled, Java calls
     convert(owner) + convert(receiver) before unDelegate(owner, receiver)
   - Rust was missing the convert() calls, which migrate legacy
     blob-style index entries to prefixed key layout

3. Add weight clamping in add_total_*_weight methods (engine.rs):
   - Java clamps to max(0, newValue) when allowNewReward() is true
   - Added matching clamping and skip-if-zero optimization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants