Commit 3866a46
committed
coins: mint the block-winning share onto the sharechain (dash/btc/bch/dgb)
Fixes #887.
mining_submit classifies a solve tighten-first: block target, then share
target. On dash, btc, bch and dgb the block arm dispatched the won block and
RETURNED, so the share arm -- the only place the sharechain mint /
create-share seam is invoked -- was never reached. Because
block_target <= share_target, a solve that clears the block target clears the
share target by definition: it is the highest-work share the node will ever
produce, and it was discarded on every block won. That costs (a) our own PPLNS
weight in the very window the block pays out from and (b) peers' view of our
best work. LTC is already correct -- core/web_server.cpp:7464 runs the
create-share hook before and independently of the block check.
Not block loss: the block submits correctly on all four coins. This is
share-weight loss.
Each coin's mint invocation is lifted VERBATIM out of the share arm into a
local helper and invoked from BOTH arms.
ORDERING. LTC mints first; here the helper runs on the won-block arm strictly
AFTER the block has been dispatched (on dash, also after the payee-guard
verdict and the recent-blocks record). The reward invariant is "never refuse a
block the daemon would ACCEPT", so nothing may be inserted ahead of the
submit: the mint walks the tracker, takes locks, can decline, and can throw.
Running it downstream reaches the same end state as LTC with none of that
exposure. The helper also catches exceptions locally on every coin (dgb's
ShareAccept previously had none), so a mint fault can never cost the block or
turn a won block into a stratum reject.
dash: the mint runs even after a payee-guard reject. The guard is a COIN-side
verdict about a stale masternode payee; the sharechain has its own acceptance
rule (the mint's X11-identity + pow<=own-committed-target gates) and the share
arm has never consulted the guard. The existing reject branch already states
the share still counts for the miner. Withholding would be a second,
self-inflicted loss on top of the forfeited block.
dgb: PRE-WIRING ONLY. Per #884 main_dgb.cpp never calls set_mint_share_fn, so
dgb cannot mint any local share today -- not this one, and not an ordinary
ShareAccept either. The won-block arm now REACHES the seam so dgb inherits the
fix the moment #884 binds it. The dgb KAT is named and commented accordingly
and asserts only seam reachability.
NO CONSENSUS CHANGE. Share construction, target derivation and serialisation
live entirely inside the untouched mint / create_local_share seams. This
changes only WHETHER the seam is invoked, never what it builds.
Tests folded into EXISTING allowlisted targets (never a new add_executable,
which would silently report "Not Run"). Each coin pins: the block still
dispatches; the share seam is reached; the seam observes the block as ALREADY
dispatched (ordering witness); and a throwing seam costs neither the block nor
the accepted reply.1 parent 3548684 commit 3866a46
10 files changed
Lines changed: 818 additions & 167 deletions
File tree
- src/impl
- bch
- stratum
- test
- btc
- stratum
- test
- dash/stratum
- dgb
- stratum
- test
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
693 | 739 | | |
694 | 740 | | |
695 | 741 | | |
| |||
731 | 777 | | |
732 | 778 | | |
733 | 779 | | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
734 | 785 | | |
735 | 786 | | |
736 | 787 | | |
| |||
740 | 791 | | |
741 | 792 | | |
742 | 793 | | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
| 794 | + | |
766 | 795 | | |
767 | 796 | | |
768 | 797 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
215 | 223 | | |
216 | 224 | | |
217 | 225 | | |
218 | 226 | | |
219 | 227 | | |
220 | 228 | | |
221 | 229 | | |
| 230 | + | |
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
| 57 | + | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
349 | 356 | | |
350 | 357 | | |
351 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
352 | 491 | | |
353 | 492 | | |
354 | 493 | | |
| |||
358 | 497 | | |
359 | 498 | | |
360 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
361 | 503 | | |
362 | 504 | | |
363 | 505 | | |
| |||
0 commit comments