nochowderforyou / clams

Clam Project
MIT License
62 stars 58 forks source link

Maintain a map storing the amount staked by each address so that 'getsta... #159

Closed dooglus closed 9 years ago

dooglus commented 9 years ago

...kedbyaddress' doesn't have to iterate through the whole wallet each time.

Proposed fix for #158.

"getstakedbyaddress" is very fast now, at least when you are enquiring about stakes with the default (1) number of confirmations.

I didn't put locks around any of this code. Is it necessary? I suppose it's possible that a block is found (possibly even causing a reorg) while CWallet::SumStakingRewards() is running. Do we need to somehow protect against that?