Post
Topic
Board Announcements (Altcoins)
Re: [ANN][CLAM] CLAMs, Proof-Of-Chain, Proof-Of-Working-Stake, a.k.a. "Clamcoin"
by
dooglus
on 11/07/2016, 19:19:51 UTC
I do not have the knowledge to read code to know how clam works.

The code is multi-threaded. So the part which loops through your own outputs checking whether they can stake runs in parallel with the part which accepts new blocks from peers.

Checking the staking wallet logs I do see that it continues to search its own outputs even if it accepts a block from a peer while searching. Here's an example:

Quote
starting stake
CWallet::CreateCoinStake() iteration 0
CWallet::CreateCoinStake() iteration 15000
CWallet::CreateCoinStake() iteration 30000
CWallet::CreateCoinStake() iteration 45000
CWallet::CreateCoinStake() found no stake
stake took 4s

starting stake
CWallet::CreateCoinStake() iteration 0
CWallet::CreateCoinStake() iteration 15000
stake 1.00 for xB2ecbVboyD513HJfvzvxw3tuNfRcUVUXv; not mine
SetBestChain: new best=5b2e7337902bc3e230541d1c47f135cd23efb2b984bc744aac54a5f14161691e  height=1070779  trust=255420176884548245025  blocktrust=523267355223939  date=07/10/16 13:24:16
ProcessBlock: ACCEPTED
CWallet::CreateCoinStake() iteration 30000
CWallet::CreateCoinStake() iteration 45000
CWallet::CreateCoinStake() found no stake
stake took 2s

starting stake
CWallet::CreateCoinStake() iteration 0
CWallet::CreateCoinStake() iteration 15000
CWallet::CreateCoinStake() iteration 30000
CWallet::CreateCoinStake() iteration 45000
CWallet::CreateCoinStake() found no stake
stake took 3s

In this case we didn't find a block, so the peer's block won. I'll see if I can find an example where JD found a block after hearing about one from a peer.

Edit: I can't find any. I suspect that although it continues looping through all the unspent outputs, accepting the peer's block has somehow made it such that no local stake will be accepted and so it's a waste of time to even continue searching in the current time slot.