Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions x/btcbridge/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
// check if the DKG request expired
if !ctx.BlockTime().Before(*req.Expiration) {
req.Status = types.DKGRequestStatus_DKG_REQUEST_STATUS_TIMEDOUT
k.SetDKGRequest(ctx, req)

continue
}

Expand All @@ -27,6 +29,8 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
// check if the DKG completion requests are valid
if !types.CheckDKGCompletionRequests(completionRequests) {
req.Status = types.DKGRequestStatus_DKG_REQUEST_STATUS_FAILED
k.SetDKGRequest(ctx, req)

continue
}

Expand All @@ -35,5 +39,6 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {

// update status
req.Status = types.DKGRequestStatus_DKG_REQUEST_STATUS_COMPLETED
k.SetDKGRequest(ctx, req)
}
}
4 changes: 3 additions & 1 deletion x/btcbridge/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ func (AppModule) ConsensusVersion() uint64 { return 1 }
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}

// EndBlock contains the logic that is automatically triggered at the end of each block
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
EndBlocker(ctx, am.keeper)

return []abci.ValidatorUpdate{}
}
4 changes: 3 additions & 1 deletion x/btcbridge/types/tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
"crypto/ed25519"
"encoding/binary"
"encoding/hex"
"reflect"

Expand Down Expand Up @@ -50,7 +51,8 @@ func VerifySignature(signature string, pubKey []byte, req *DKGCompletionRequest)

// GetSigMsgFromDKGCompletionReq gets the msg to be signed from the given DKG completion request
func GetSigMsgFromDKGCompletionReq(req *DKGCompletionRequest) []byte {
rawMsg := Int64ToBytes(req.Id)
rawMsg := make([]byte, 8)
binary.BigEndian.PutUint64(rawMsg, req.Id)

for _, v := range req.Vaults {
rawMsg = append(rawMsg, []byte(v)...)
Expand Down