-
Notifications
You must be signed in to change notification settings - Fork 102
/
nodes.go
35 lines (31 loc) · 927 Bytes
/
nodes.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
package keeper
import (
sdk "github.com/pokt-network/pocket-core/types"
"github.com/pokt-network/pocket-core/x/nodes/exported"
)
// "GetNode" - Gets a node from the state storage
func (k Keeper) GetNode(ctx sdk.Ctx, address sdk.Address) (n exported.ValidatorI, found bool) {
n = k.posKeeper.Validator(ctx, address)
if n == nil {
return n, false
}
return n, true
}
// "AwardCoinsForRelays" - Award coins to nodes for relays completed using the nodes keeper
func (k Keeper) AwardCoinsForRelays(
ctx sdk.Ctx,
chain string,
relays int64,
toAddr sdk.Address,
) sdk.BigInt {
return k.posKeeper.RewardForRelaysPerChain(
ctx,
chain,
sdk.NewInt(relays),
toAddr,
)
}
// "BurnCoinsForChallenges" - Executes the burn for challenge function in the nodes module
func (k Keeper) BurnCoinsForChallenges(ctx sdk.Ctx, relays int64, toAddr sdk.Address) {
k.posKeeper.BurnForChallenge(ctx, sdk.NewInt(relays), toAddr)
}