4
4
"fmt"
5
5
"time"
6
6
7
+ "github.com/deso-protocol/uint256"
7
8
"github.com/golang/glog"
8
- "github.com/holiman/uint256"
9
9
"github.com/pkg/errors"
10
10
11
11
"github.com/deso-protocol/core/bls"
@@ -695,8 +695,8 @@ func (fe *fastHotStuffEventLoop) tryConstructVoteQCInCurrentView() *FastHotStuff
695
695
votesByValidator := fe .votesSeenByBlockHash [voteSignaturePayload ]
696
696
697
697
// Compute the total stake and total stake with votes
698
- totalStake := uint256 .NewInt ()
699
- totalVotingStake := uint256 .NewInt ()
698
+ totalStake := uint256 .NewInt (0 )
699
+ totalVotingStake := uint256 .NewInt (0 )
700
700
701
701
// Track the signatures and signers list for the chain tip
702
702
signersList := bitset .NewBitset ()
@@ -705,7 +705,7 @@ func (fe *fastHotStuffEventLoop) tryConstructVoteQCInCurrentView() *FastHotStuff
705
705
// Iterate through the entire validator list and check if each one has voted for the tip block. Track
706
706
// all voters and their stakes.
707
707
for ii , validator := range validatorList {
708
- totalStake = uint256 .NewInt ().Add (totalStake , validator .GetStakeAmount ())
708
+ totalStake = uint256 .NewInt (0 ).Add (totalStake , validator .GetStakeAmount ())
709
709
710
710
// Skip the validator if it hasn't voted for the block
711
711
vote , hasVoted := votesByValidator [validator .GetPublicKey ().ToString ()]
@@ -714,7 +714,7 @@ func (fe *fastHotStuffEventLoop) tryConstructVoteQCInCurrentView() *FastHotStuff
714
714
}
715
715
716
716
// Track the vote's signature, stake, and place in the validator list
717
- totalVotingStake = uint256 .NewInt ().Add (totalVotingStake , validator .GetStakeAmount ())
717
+ totalVotingStake = uint256 .NewInt (0 ).Add (totalVotingStake , validator .GetStakeAmount ())
718
718
signersList .Set (ii , true )
719
719
signatures = append (signatures , vote .GetSignature ())
720
720
}
@@ -819,8 +819,8 @@ func (fe *fastHotStuffEventLoop) tryConstructTimeoutQCInCurrentView() *FastHotSt
819
819
}
820
820
821
821
// Compute the total stake and total stake with timeouts
822
- totalStake := uint256 .NewInt ()
823
- totalTimedOutStake := uint256 .NewInt ()
822
+ totalStake := uint256 .NewInt (0 )
823
+ totalTimedOutStake := uint256 .NewInt (0 )
824
824
825
825
// Track the high QC view for each validator
826
826
highQCViews := make ([]uint64 , len (validatorList ))
@@ -835,7 +835,7 @@ func (fe *fastHotStuffEventLoop) tryConstructTimeoutQCInCurrentView() *FastHotSt
835
835
// for the signersList bitset. In practice, the validator list is expected to be <= 1000 in size, so
836
836
// this loop will be fast.
837
837
for ii , validator := range validatorList {
838
- totalStake = uint256 .NewInt ().Add (totalStake , validator .GetStakeAmount ())
838
+ totalStake = uint256 .NewInt (0 ).Add (totalStake , validator .GetStakeAmount ())
839
839
840
840
// Skip the validator if it hasn't timed out for the previous view
841
841
timeout , hasTimedOut := timeoutsByValidator [validator .GetPublicKey ().ToString ()]
@@ -844,7 +844,7 @@ func (fe *fastHotStuffEventLoop) tryConstructTimeoutQCInCurrentView() *FastHotSt
844
844
}
845
845
846
846
// Track the signatures, timed out stake, and high QC views for the validator
847
- totalTimedOutStake = uint256 .NewInt ().Add (totalTimedOutStake , validator .GetStakeAmount ())
847
+ totalTimedOutStake = uint256 .NewInt (0 ).Add (totalTimedOutStake , validator .GetStakeAmount ())
848
848
signersList .Set (ii , true )
849
849
signatures = append (signatures , timeout .GetSignature ())
850
850
highQCViews [ii ] = timeout .GetHighQC ().GetView ()
0 commit comments