Page 5 of 5

Re: RESOLVED: Seems this bug is still hanging around.....

Posted: Sun Jul 17, 2016 8:13 am
by Steve Sokolowski
GenTarkin wrote:Well, after digging around some more and experimenting, came up w/ a more advanced fix.
No issues w/ balance - load balance that I can see =)
But basically, now the message is still displayed but I appended (normal for multicoin pools) to it and functionally the network diff & current block hash properly update back to the old block its mining. So, the "found new block messages" shouldnt show anymore because of improperly displayed net diff.

Here's the code, if you search for "if (was_active)" in miner.c
Just add the parts of my code that are different, to miner.c then recompile bfgminer

Code: Select all

                        if (was_active)
                        {
                                struct block_info * const t = calloc(sizeof(struct block_info), 1);
                                memcpy(t->prevblkhash, prevblkhash, sizeof(t->prevblkhash));
                                t->block_id = block_id;
                                t->block_seen_order = new_blocks++;
                                t->first_seen_time = time(NULL);
                                // Pool actively changed block
                                if (pool == current_pool())
                                        restart = true;
                                if (block_id == blkchain->currentblk->block_id)
                                {
                                        // Caught up, only announce if this pool is the one in use
                                        if (restart)
                                        {
                                                set_curblock(goal, t);
                                                set_blockdiff(goal, work);
                                                applog(LOG_NOTICE, "%s %d caught up to new block",
                                                       work->longpoll ? "Longpoll from pool" : "Pool",
                                                       pool->pool_no);
                                        }
                                }
                                else
                                {
                                        // Switched to a block we know, but not the latest... why?
                                        // This might detect pools trying to double-spend or 51%,
                                        // but let's not make any accusations until it's had time
                                        // in the real world.
                                        set_blockdiff(goal, work);
                                        set_curblock(goal, t);
                                        char hexstr[65];
                                        blkhashstr(hexstr, prevblkhash);
                                        applog(LOG_WARNING, "%s %d is issuing work for an old block: %s (Normal if multicoin pool)",
                                               work->longpoll ? "Longpoll from pool" : "Pool",
                                               pool->pool_no,
                                               hexstr);
                                }
                        }
                }
Can you submit this fix as a pull request to the official repo? That way, they should merge it and then the answer I can write on the documentation page is "upgrade to GenTarkin's version of bfgminer."

Re: RESOLVED: Seems this bug is still hanging around.....

Posted: Sun Jul 17, 2016 2:45 pm
by GenTarkin
Done: https://github.com/luke-jr/bfgminer/pull/673
Lets see if it gets accepted .. lol first time doing this =P

Re: RESOLVED: Seems this bug is still hanging around.....

Posted: Sun Jul 17, 2016 4:00 pm
by GenTarkin
Well according the luke-jr my changes "break normal use" ... not in my testing but w/e =(

He insists the pool itself implement set_goal