@@ -37,3 +37,76 @@ func (r *Recipient) GetScript() []byte {
3737
3838 return r .script
3939}
40+
41+ type PaymentOptions struct {
42+ Interval int64 `json:"interval"` // seconds between payout runs (default 600)
43+ MinPayment float64 `json:"minPayment"` // minimum coin owed before a miner is paid
44+
45+ Daemon int `json:"daemon"` // index into daemons[] used for wallet RPC (default 0)
46+
47+ // PayMode selects how miners are rewarded:
48+ // "prop" (default) proportional to that block's round shares
49+ // "pplns" proportional to the last-N-difficulty window of shares
50+ // "solo" the miner who found the block takes the whole reward
51+ // "pps" pay a fixed rate per share immediately; found blocks
52+ // just refill the pool wallet (the pool bears variance)
53+ PayMode string `json:"payMode"`
54+ // PPLNSWindow is the pplns look-back as a total share difficulty; <=0 falls
55+ // back to the block's own round (so pplns degrades to prop).
56+ PPLNSWindow float64 `json:"pplnsWindow"`
57+ // PPSRate is the pps price paid per unit of share difficulty (in coin). It
58+ // must be set (>0) when payMode is "pps".
59+ PPSRate float64 `json:"ppsRate"`
60+
61+ // --- coin-fork configurability ---
62+
63+ // Magnitude is the number of base units (satoshis) in one coin, e.g. 1e8 for
64+ // Bitcoin. 0 auto-detects from the wallet's getbalance precision.
65+ Magnitude float64 `json:"magnitude"`
66+
67+ // MinConfirmations is coinbase maturity: a found block's reward is only paid
68+ // once its generation transaction has at least this many confirmations
69+ // (default 100; some forks use 30/40/240).
70+ MinConfirmations int64 `json:"minConfirmations"`
71+
72+ // AddressCheckMethod is the wallet RPC used to verify the pool owns its
73+ // payout address: "getaddressinfo" (Bitcoin Core 0.18+, default) or
74+ // "validateaddress" (older cores / forks that kept it).
75+ AddressCheckMethod string `json:"addressCheckMethod"`
76+
77+ // SendManyDummy is the leading dummy/account argument to sendmany. Bitcoin
78+ // Core requires it and keeps it as "" (the default).
79+ SendManyDummy string `json:"sendManyDummy"`
80+ // OmitSendManyDummy drops the leading argument entirely for forks whose
81+ // sendmany takes only the {address:amount} map.
82+ OmitSendManyDummy bool `json:"omitSendManyDummy"`
83+ }
84+
85+ // WithDefaults returns a copy with unset fork knobs filled with the Bitcoin
86+ // Core defaults, so a minimal config still works on mainstream forks.
87+ func (o * PaymentOptions ) WithDefaults () * PaymentOptions {
88+ c := * o
89+ if c .Interval <= 0 {
90+ c .Interval = 600
91+ }
92+ if c .MinConfirmations <= 0 {
93+ c .MinConfirmations = 100
94+ }
95+ if c .AddressCheckMethod == "" {
96+ c .AddressCheckMethod = "getaddressinfo"
97+ }
98+ if c .PayMode == "" {
99+ c .PayMode = PayModeProp
100+ }
101+ c .PayMode = strings .ToLower (c .PayMode )
102+ // SendManyDummy defaults to "" (its zero value), which is what Bitcoin Core wants.
103+ return & c
104+ }
105+
106+ // Reward schemes selectable via PayMode.
107+ const (
108+ PayModeProp = "prop"
109+ PayModePPLNS = "pplns"
110+ PayModeSolo = "solo"
111+ PayModePPS = "pps"
112+ )
0 commit comments