livepeer / protocol

Livepeer protocol
MIT License
154 stars 45 forks source link

bonding: Return current total active stake in getTotalBonded() #341

Closed yondonfu closed 5 years ago

yondonfu commented 5 years ago

This PR updates BondingManager.getTotalBonded() to return currentRoundTotalActiveStake instead of iterating through the current members of the transcoder pool. This change saves gas during round initialization - instead of using N SLOADs (where N is the size of the pool) getTotalBonded() uses a single SLOAD because currentRoundTotalActiveStake would have been already set by the call to BondingManager.setCurrentRoundTotalActiveStake() earlier during round initialization.

Fixes #334