-
Notifications
You must be signed in to change notification settings - Fork 6
/
worker.go
59 lines (48 loc) · 1.46 KB
/
worker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package custodian
import (
"context"
"github.com/MixinNetwork/trusted-group/mtg"
)
const (
XINAssetId = "c94ac88f-4671-3976-b60a-09064f1811e8"
// domain do the first key, next should be from the first key
CustodianActionRefreshKey = 1
CustodianActionDistribute = 2
// every signer node will send this to the mtg
// everyday at a specific time
// then at some point, a random output will cause
// all signer nodes to finalize the works
CustodianActionVoteWorks = 3
// then the signer mtg send this action to keeper mtg
// the custodian will process this then
CustodianActionFinalizeWorks = 4
)
type Worker struct {
store *SQLite3Store
signerAssetId string
keeperAssetId string
observerAssetId string
}
func NewWorker(s *SQLite3Store) *Worker {
return &Worker{
store: s,
}
}
func (worker *Worker) ProcessOutput(ctx context.Context, out *mtg.Action) ([]*mtg.Transaction, string) {
return nil, ""
}
func (worker *Worker) Boot(ctx context.Context) {
go worker.loopKernelMintDistributions(ctx)
}
func (worker *Worker) handleRefreshKey() {
// domain signature verification
// send a request to signer keygen, ed25519 mixin
// receive keygen from signer and store the key
// custodian use public derivation of spend key
}
func (worker *Worker) loopKernelMintDistributions(ctx context.Context) {
//for {
// loop read mint distributions to the custodian key
// for new distribution, send the mint to keeper MTG with custodian action distribute
//}
}