tronprotocol / java-tron

Java implementation of the Tron whitepaper
GNU Lesser General Public License v3.0
3.72k stars 1.4k forks source link

Private node not receiving vote rewards #4097

Closed urosh closed 2 years ago

urosh commented 2 years ago

1. What did you do?

I am running three private nodes. One default SR comes from the genesis file.

Another one that I applied for using applyForSR smart contract.

Another node I run as SR using witness permission change logic. I modified the witness permission of the node SR account.

All three nodes are receiving rewards.

I created one account and voted for 2 nodes.

2. What did you expect to see?

When calling getReward API using tronweb I am always getting 0 in response both for SR or for vote account.

For SR i can claim rewards though but when trying to check pending rewards I am not able to do so.

For the vote account, I am not able to claim rewards, even though brokerage is set to default 20%.

3. What did you see instead?

When making a call to the walllet/withdrawbalance endpoint of the node i am getting witnessAccount does not have any rewards for the vote account.

This happens after almost three days of constant running of the nodes. Does the 3 days freeze period affect this, or I should be able to see the rewards as soon as the vote is cast, and the SR receives block rewards?

Also why is the getReward API using tronweb returning 0 in all cases?

urosh commented 2 years ago

Actually, I managed to get this working.

I did two things that made difference:

With these 2 steps even without changing the ratio, I am getting the rewards data from the getRewards API.

I will play around and update if I find anything else.

urosh commented 2 years ago

Just checked, had to follow these 2 steps to be able to see rewards in getRewards API. Only after the proposal passed, rewards started appearing. Might be useful for someone. Not sure, why is it happening in this way?

Benson0224 commented 2 years ago

thanks for your sharing, it is very helpful.

Just checked, the proposal item should be changedDelegation, not allowChangeDelegation . you can find all the configuration item from here: https://github.com/tronprotocol/java-tron/blob/develop/common/src/main/java/org/tron/common/parameter/CommonParameter.java#L352

the configurations should like below:

committee = {  
allowCreationOfContracts = 0  //mainnet:0 (reset by committee),test:1  
allowAdaptiveEnergy = 0  //mainnet:0 (reset by committee),test:1
changedDelegation = 1
}
urosh commented 2 years ago

I will check it out, as it would make life easier. I think i tried with changeDelegation and that didn't work.

urosh commented 2 years ago

Yep, setting changedDelegation = 1 in committee allows you to change the brokerage ratio out of the box, and rewards are shown when calling the getRewards API. So no need to submit a proposal and vote, and go through all this.